Recent posts

Ansible Conditionals

April 18, 2017 | less than 1 minute read

Inline expressions Reference: Inline ‘if’ expressions It’s possible to use inline if-expressions: {{ 'Update' if files else 'Continue' }} Note: See the Jinja2 Filters section for more information. ‘if/else’ example Reference: cidr block’s git repo "{{ 'unknown' if ssh_output|failed else ssh_output['stdout'][0]|determine_os}}" Note: Se...

Ansible Built-in Variables

April 18, 2017 | less than 1 minute read

Ansible has built in variables which you can come in handy with some Playbooks. They can be viewed using the following Ad-Hoc command: ansible all -i 192.168.0.211, -m debug -a "msg=" or this Task: --- - name: Display vars debug: msg= Note that the latter provides much more information than the former. When the above Task is run, one of...

Ansible Ad-Hoc Commands

April 18, 2017 | less than 1 minute read

As per the Ansible documentation: An ad-hoc command is something that you might type in to do something really quick, but don’t want to save for later. For example, if you want to you can test a module, (e.g IOS_Facts), without having to write a Playbook by using Ad-Hoc commands such as this: ansible all -i 192.168.0.210, -c local -m ios_fact...

Use Ansible Tags to Organise your Plays & Tasks

April 14, 2017 | 7 minute read

The Ansible tag documentation does a great job of explaining tags, tag re-used and tag inheritance.  However, I’d like to dive a little deeper to show you just how useful they can be. To get the most out of this post you’ll need to be familiar with the ways in which you can structure your Playbooks. If you don’t know how they can be structured,...

The Anatomy of an Ansible Playbook

April 09, 2017 | 6 minute read

I published my Ansible Playbook Structure post a few months ago. Upon re-reading it recently I felt that it lacked detailed around the components of a playbook. I therefore intend to fill in the gap with this post. 30,000 Foot View Ansible uses the following components to work: Inventory file(s) Group vars Host vars Playbooks Roles...