Recent posts

Ansible Variable Persistence

April 18, 2017

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

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

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...

Ansible Minimum Viable Playbook (MVP)

April 18, 2017

Reference: Adam’s Tech Blog The Minimum Viable Playbook (MVP) is the shortest, most useful Ansible playbook I have. Whenever I need to write some Ansible code and I’m not entirely sure I’m doing it right (which is often), I implement it first in the MVP so I can test it quickly. Here’s my latest iteration: - hosts: localhost connection: loca...

Ansible match() Test

April 18, 2017

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 ...