Ansible is a powerful IT automation tool with lots of modules and active development. Unfortunately, the only version available for stock Raspberry Pi is old. I wanted to use some of the newer modules and features, so I needed to install at least version 2.2. This tutorial will walk you through installing Ansible 2.2.0 on a Raspberry Pi running Raspbian “jessie”. The version of Raspbian I did this on was tagged “2016-09-23”.
Creating a Debian package for Ansible requires a lot of prerequisites, including TeX Live, which can take up almost 2GB of space. If you don’t want to do this yourself, you can try downloading the Ansible package I built. It might be old by the time you read this, though!
Install Prerequisite Packages
Log into the terminal of your Raspberry Pi and run the following command to install the required packages.
sudo apt install asciidoc devscripts python-dev libffi-dev libssl-dev cdbs sshpass -y
Download and Prepare the Ansible Repo
Ansible is available for download from GitHub. Use the following commands to retrieve the Ansible source code and modules.
git clone git://github.com/ansible/ansible.git --recursive
Use these commands as a guide to select and checkout a stable Ansible release. The list of tags should give you clues as to which tag is the latest and not a development version.
git tag -l
git checkout v220.127.116.11-1
Your new .deb package will be located in ./deb-build/unstable/. You can install it with the
dpkg command like this.
sudo dpkg -i ./deb-build/unstable/ansible_18.104.22.168-100.git201611010320.cdec853.HEAD~unstable_all.deb
Using the Newest Ansible Features
My goal was to use Ansible on my Raspberry Pi to implement my poor-man’s dynamic DNS solution. However, you might also want to use your RPi as a centralized Ansible hub to control a cluster like the Raspberry Pi Dramble. Also consider checking out the ansible-simple-slurm-cluster repo on GitHub for more ideas.
Let me know how you’re using Ansible on your Raspberry Pi in the comments!