Ansible – Template: to_nice_json

In order to create a file from the template and immediately save it as “Pretty JSON“, you can use the “copy” module with the “content” key. For example, save the template “config.j2” as the file “/app/config.json” Playbook:

Jenkins – Active Choice: CheckBox – Default values

  When working with the Active Choice CheckBox parameter, you can select the default values by adding the “: selected” parameter Pipeline:   When assembling with parameters, two environments at once, “Development” and “Production” will be selected by default

Jenkins – Active Choice: Pipeline examples

  A few examples of how Active Choices parameters in Pipeline as a code Example 1 Single selection from the list provided. A drop-down list of environments, by default, the first item in the list is selected. Pipeline:  

Jenkins – Username

In order to find out Jenkins username, you need a plugin user build vars Go to Jenkins settings   Section “Manage Plugins”   Go to the “Available” tab and specify “user build vars” in the search. Install it.   An example of using a plugin from Pipeline:   The module also has the following variables: … Continue reading "Jenkins – Username"

FIX ERROR – Ansible AWS SSM: AnsibleError: An unhandled exception occurred while templating

When trying to get a value from AWS SSM, Ansible Playbook using Python3 as an interpreter generates the following error: fatal: [localhost-py3]: FAILED! => {“changed”: false, “msg”: “AnsibleError: An unhandled exception occurred while templating ‘{{ lookup(‘aws_ssm’, ‘server_listeners’, decrypt=false, region=’eu-west-1′) }}’. Error was a <class ‘ansible.errors.AnsibleError’>, original message: An unhandled exception occurred while running the lookup … Continue reading "FIX ERROR – Ansible AWS SSM: AnsibleError: An unhandled exception occurred while templating"

CodeCommit – Git

HTTPS In order to be able to work with the Git repository in CodeCommit using the AIM role, AWS Cli must be installed on the instance. You will also need “credential-helper“, for this we create a configuration file for Git:   And copy the following into it:   Now you can work with CodeCommit over … Continue reading "CodeCommit – Git"

Jenkins – Checking if a string value is set to a parameter

  Check if the value of the variable “GIT_COMMIT_ID” is set, if so, then do a checkout by the hash of the commit, if not, then do a checkout by the name of the branch. The variable “GIT_BRANCH_NAME” is taken from the Active Choice parameter. Jenkinsfile: