Recent posts

Installing NTC Ansible

April 27, 2017 | 2 minute read

I’ve written about NTC-Ansible a couple of times already and thought now would be a good time to run you through the installation process. The github page provides some great information on the process, but I’d like to add a few extra details in this post. Note that there are two ways in which you can install custom modules. They work as well a...

Jinja2 Tests Overview

April 18, 2017 | less than 1 minute read

As per the Jinja documentation: Beside “filters“, there are also so-called “tests” available. Tests can be used to test a variable against a common expression. Filters such as selectattr() can accept tests as a parameter. As per the documentation: “selectattr() filters a sequence of objects by applying a test to the specified attribute of eac...

Jinja2 selectattr() Filter

April 18, 2017 | 1 minute read

As per the documentation: “selectattr() filters a sequence of objects by applying a test to the specified attribute of each object, and only selecting the objects with the test succeeding. If no test is specified, the attribute’s value will be evaluated as a boolean.“ Example #1 This blog post does a great job of demonstrating how to use sele...

Jinja2 Overview

April 18, 2017 | less than 1 minute read

There are two ways in which you can use Jinja templates inside of Ansible are: Templates Filters This blog post demonstrates both of these techniques being used. The information contained in the post is contained below for convenience. Data The following data will be used by the template and filter in the subsequent sections of this pa...

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