Setting up Ansible for hacking

19 Apr 2014 in TIL

When trying my hand at Ansible module development, I had a few issues getting Ansible running from a checkout. Here's how I fixed it:

The Ansible documentation for running from source gives us these instructions:

bash
git clone git://github.com/ansible/ansible.git
cd ./ansible
source ./hacking/env-setup

Unfortunately, this doesn't give us all the dependencies we need. To keep this completely separate to your normal installs, let's get Ansible running from inside a virtualenv with it's own dependencies

bash
sudo pip install virtualenv
virtualenv .virtualenv
source .virtualenv/bin/activate
pip install pyyaml jinja2 pycrypto

If you get an error about "unknown argument '-mno-fused-madd'" when installing pycrypto, you can flag it as a warning rather than an error with the following command:

bash
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycrypto

Now, if you run ansible --version, you should see the version that you checked out of source control.

ansible 1.5.2