Archive for the ‘Ansible’ Category

Use restview to to make the Ansible rst documentation browsable

The ansible-doc package not only installs the command line tool but also some quite detailed Ansible documentation in rst format. It would be nice if it was browsable in a html format. Here’s how that can happen (Redhat/CentOS) First install pip and restview… sudo yum install python-pip sudo pip install restview This will allow all […]

Create a space-separated list of play_hosts in Ansible

Sometimes I need a list of hosts as a string when working with Ansible. Pacemaker clustering is one example. Here’s a snippet of Ansible that does this.. – name: Setup list of cluster hosts set_fact: host_list: “{{ host_list }}{{ (play_hosts.index(item) == 0) | ternary(”,’ ‘) }}{{ item }}” loop: “{{ play_hosts }}” run_once: yes This […]

Offset cron jobs with Ansible

Sometimes I want to run the same cronjob on a few hosts but I might want to offset them slightly if I’m accessing any shared resources. Here’s an easy way to do that, for a small number of hosts, using Ansible… – name: Ensure cron exists cron: name: Test Job minute: “{{ play_hosts.index(inventory_hostname) }}-59/5” job: […]

Creating a Vagrant, Virtualbox & Ansible environment in the Windows Linux Subsystem

I’ve just been given a new Windows corporate laptop, with a huge amount of RAM (64GB), a large number of cores, and I wanted to start using this as my main development virtualisation platform. I do a lot of stuff with Vagrant, Ansible and VirtualBox and Windows hasn’t always been a welcome home for this […]

Ansible Playbook for Raspberry Pi Headphones Setup

I’ve created another Ansible Playbook for the Raspberry Pi to setup Headphones. It’s hosted over on my Github: PiHeadphones The playbook can be execute with the following command… ansible-playbook -i inventory headphones.yaml The inventory file should contain the name of your Raspberry Pi and should already be setup for ssh. The playbook will clone the […]