Recent posts

Ansible vars Lists

April 18, 2017 | less than 1 minute read

Lists can be provided to a module through vars specified inside a Playbook or they can be provided directly inside a Task. In the examples below we want to send two “show” commands to the devices. The former example uses a vars  list while the latter defines the list inside of the module call: List inside vars: - name: run show commands hos...

Ansible Variables

April 18, 2017 | 3 minute read

Using Variables: About Jinja2 Reference: Ansible Ansible allows you to reference variables in your playbooks using the Jinja2 templating system. While you can do a lot of complex things in Jinja, only the basics are things you really need to learn at first. For instance, in a simple template, you can do something like: My amp goes to {{ max_...

Ansible Variable Persistence

April 18, 2017 | less than 1 minute read

Reference: Stackoverflow set_fact module only sets facts available during a run. For persistent facts, you’ll need to either: Static: define them in one of the following: vars/ group_vars/ host_vars/ Dynamic: Assign them to hosts using your language of choice via Ansible’s Dynamic Inventory: ...

Ansible set_facts

April 18, 2017 | less than 1 minute read

Reference: Ansible This module allows setting new variables. Variables are set on a host-by-host basis just like facts discovered by the setup module. These variables will be available to subsequent plays during an ansible-playbook run, but will not be saved across executions even if you use a fact cache. Per the standard Ansible variabl...

Ansible search() Test

April 18, 2017 | less than 1 minute read

Reference: Ansible match  requires a complete match in the string, while search  only requires matching a subset of the string. Example As per the selectattr( )  page, the Jinja equalto( )  Test, as well as the Ansible match( )  and search( )  Tests all work in a similar fashion. Using this dictionary: - hosts: localhost connection: local...