Setting up Ansible for hacking

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:

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

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:

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

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply