K.S. Root

Installing Ansible 2.X on Trusty Tahr

The versions of Ansible that ship with Trusty Tahr are a little stale.

sudo apt-cache madison ansible
   ansible | 1.7.2+dfsg-1~ubuntu14.04.1 | http://us.archive.ubuntu.com/ubuntu/ trusty-backports/universe amd64 Packages
   ansible | 1.5.4+dfsg-1 | http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
   ansible | 1.5.4+dfsg-1 | http://us.archive.ubuntu.com/ubuntu/ trusty/universe Sources
   ansible | 1.7.2+dfsg-1~ubuntu14.04.1 | http://us.archive.ubuntu.com/ubuntu/ trusty-backports/universe Sources

Fortunately up-to-date versions can installed from PyPI.

  1. First install some build dependencies needed by to compile the cryptography package.

     sudo apt-get install python-dev libffi-dev libssl-dev build-essential
    
  2. Next, install Ansible.

     sudo pip install --upgrade ansible
    
  3. Verify the version.

     ansible --version
     ansible 2.1.1.0
       config file = /etc/ansible/ansible.cfg
       configured module search path = ['/usr/share/ansible']
    
  4. Finally, remove the build dependencies of the cryptography package.

     sudo apt-get autoremove python-dev libffi-dev libssl-dev
    

    You can also remove the build-essential meta-package if you don't plan on compiling anything else on the host.