Posts

Showing posts with the label Deployment

CircleCI - Different Value To Environment Variable According To The Branch

Answer : The question is almost 2 years now but recently I was looking for similar solution and I found it. It refers to CircleCI's feature called Contexts (https://circleci.com/docs/2.0/contexts/). Thanks to Contexts you can create multiple sets of environment variables which are available within entire organisation. Then you can dynamically load one of the sets depending of workflows' filters property. Let me demonstrate it with following example: Imagine you have two branches and you want each of them to be deployed into different server. What you have to do is: create two contexts (e.g. prod-ctx and dev-ctx ) and define SERVER_URL environment variable in each of them. You need to log into CircleCI dashboard and go to "Settings" -> "Contexts". in your .circleci/config.yml define job's template and call it deploy : deploy: &deploy steps: - ... define workflows: workflows: version: 2 deploy: jobs: - dep...

Ansible Print Debug Msg Variable

Answer : Solution 1: Try this: - name: Print mosh version debug: "msg=Mosh Version: '{{ mosh_version.stdout }}'" More info in http://docs.ansible.com/YAMLSyntax.html#gotchas Edited: Something like this works perfect for me: - name: Check Ansible version command: ansible --version register: ansibleVersion - name: Print version debug: msg: "Ansible Version: {{ ansibleVersion.stdout }}" http://pastie.org/private/cgeqjucn3l5kxhkkyhtpta Solution 2: Simplest answer - debug: var=mosh_version.stdout Solution 3: I have displayed variable and message in the debug same task. Ansible Task - name: Report the /boot/initramfs file status for latest installed kernel debug: msg: "{{ ansible_hostname }} = {{INITRAMFS_LAST_KERNEL.stdout}}" Output TASK [os-upgrade.linux : Report the /boot/initramfs file status for latest installed kernel] ******************************************* ok: [ANSIBLENODE] => { ...