Archive for the ‘Ansible’ Category

Offset cron jobs with Ansible


Warning: count(): Parameter must be an array or an object that implements Countable in /home/fbsqlcom/public_html/youdidwhatwithtsql.com/wp-content/plugins/wp-codebox/main.php on line 31

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… ?View Code YAML- name: Ensure cron exists cron: name: Test Job minute: "{{ play_hosts.index(inventory_hostname) […]

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… ?View Code BASHansible-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 […]

Ansible: Find files newer than another

I needed to figure out a way of identifying files newer than another one in Ansible. Here’s an outline of the solution I came up with. First we need to create a bunch of directories and folder, with modified mtime values, that we can work with. ?View Code BASHmkdir dir1; mkdir dir2; # Set the […]

Setting up a Ansible Module Test Environment

I’ve begun developing some Ansible modulesĀ and have created a Vagrant environment to help with testing. You can check it over over on my github. The environment has been created to test some MongoDB modules but can easily be repurposed to another use. It’s quite simple to get started; ?View Code BASHgit clone https://github.com/rhysmeister/AnsibleTest.git cd AnsibleTest […]