Articles about Ansible

Ansible - Sublime Text

I recently moved from Text Wrangler to Sublime Text for editing YAML files for Ansible. Getting it set up right involves very little and now with Ansible syntax highlighting it offers a light weight editor for your plays. In this post I note down some of the steps to get it setup the way I like it.

Ansible filters for taming lists (part 1)

In this article I look at a very simple example of how to convert complex variable structures to simple lists using Jinja2 filters within an Ansible task.

YAML Death by non-breaking spaces

Working on a long Ansible play today - I was tripped up by a hidden unicode character inadvertently entered in to a YAML file - resulting in a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) slap in the face. Here is how to deal with that!

Jinja errors when running Ansible tasks

One of the great things about Ansible is being able to use Jinja filters both in templates and in yaml files.
I came across a not so great thing today though. Running a play I got the following error: "template error while templating string: expected token 'end of print statement', got ':'"
But the error was 'thrown' by a task I haven't changed in ages. It appears it actually related to a jinja filter error in a subsequent task.

Testing configuration files before they go live - with Ansible

I came across a great Ansible tip recently that showed how to use the validate option of the template module in Ansible. A great solution for testing configuration before it goes live. However it doesn't work with Apache (apachectl -t -f) - you get a validation error like "Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration" for syntax that is perfectly valid. A bit of investigation shows though that this is expected and you have to go a bit further - but I came up with a solution.

Using Ansible to protect against 'Connection attempts using mod_proxy'

I regularly encounter issues that arise from reviews of server security, log reviews etc that provide good examples of how Ansible can be used to respond to an issue.
If you are using a utility like Logwatch to keep an eye on activity on your servers you may occasionally see an entry such as 'Connection attempts using mod_proxy' - Addressing this with Ansible is simple, and maintains the state of your security measures.

Contact