Recent posts

Jinja2 map() Filter

April 18, 2017 | 2 minute read

Reference: jinja Applies a filter on a sequence of objects or looks up an attribute. This is useful when dealing with lists of objects but you are really only interested in a certain value of it. The basic usage is mapping on an attribute. Imagine you have a list of users but you are only interested in a list of usernames: Users on this page:...

Jinja2 Filter Overview

April 18, 2017 | 3 minute read

Reference: Stack Overflow With the pipe character you pass a value to a filter. There are numerous Jinja 2 filters but Ansible brings some additional filters. (Also see Conditionals.) The term filter might be confusing at times because all the filters work very differently. Some for example reduce a result set of a hash/array, some modify cont...

Jinja2 equalto() Test

April 18, 2017 | less than 1 minute read

Reference: Jinja Check if an object has the same value as another object. 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 gather_facts: no vars: network: address...

Jinja2 default() Test

April 18, 2017 | less than 1 minute read

Example #1 Reference: Jinja Syntax: default(value, default_value=u'', boolean=False) Example #1 If the value is undefined it will return the passed default value, otherwise the value of the variable: {{ my_variable|default('my_variable is not defined') }} This will output the value of my_variable  if the variable was defined, otherwise ...

Git Local Overwrite

April 18, 2017 | 1 minute read

If your local repository is behind that of the remote repository and your locally tracked files differ from those of the remote repository, you will encounter an error. Performing the steps will result in the following: If the locally tracked files exist on the remote repository, the remote files will overwrite the local files. If the loca...