Install Ansible 2.5 on Debian 9 Stretch or Ubuntu 18.04 from source

Install Ansible 2.5 on Debian

Ansible is an open-source automation engine like Chef, Puppet, Salt, CFEngine,

It’s a very useful tool if you manage several servers, more than 50 for example.

Ansible is written in python and have a lots of advandages :

  • Ansible is agentless (no agent needed on remote server, Ansible use SSH and current user ssh authorisation).
  • You can install it and manage remote servers from your laptop, I prefer nonetheless to install it on a central management server.
  • Ansible installation is minimal, compilation do not need a lot of dependencies.
  • Ansible has the reputation to be easy to master (Ansible is design for DevOps ^^).
  • A lot of Playbook are already available (a Playbook, is a template).
  • Is not written on ruby like Puppet 🙂

Ansible installation not need a lot of dependencies, so I prefer to build Ansible package from source in order to have last version and last functionalities.

I – Install prerequisite

Ancible required few prerequisite build-essential, git and some python and openssl tools.

root@ansible:~# apt update
root@ansible:~# apt install make git make python-setuptools gcc python-dev libffi-dev libssl-dev python-packaging

II – Download Ansible source from Official GIT repository

root@ansible:~# cd /usr/local/src/
root@ansible:/usr/local/src# git clone git://
root@ansible:/usr/local/src# cd ansible

III – List available Ansible version

root@ansible:/usr/local/src/ansible# git branch -a | grep stable

IV – Install Ansible from source

I choose the last stable version (Ansible 2.5 “Kashmir”).

Release note of Ansible 2.5 :

root@ansible:/usr/local/src/ansible# git checkout stable-2.5
root@ansible:/usr/local/src/ansible# source ./hacking/env-setup
root@ansible:/usr/local/src/ansible# make && make install
Compilation take 2/3 minutes with a little server with 1CPU (2 Core) and 2 Giga of RAM.
If you see the error yaml.h during the make, cancel and install "apt install libyaml-dev"

V – Test Ansible

You can test if the program work correctly, by calling him with the argument –version

admin_florian@ansible:~$ ansible --version
ansible 2.5.0
config file = None
configured module search path = [u'/home/florian/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.5.0-py2.7.egg/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.14+ (default, Mar 13 2018, 15:23:44) [GCC 7.3.0]

You can now write your own playbook and appreciate this great and magical tools !!!

For security issue, I advise to not use the root account, or account named with a predictable name (example: admin/ansible/manager/etc...). For my part, I use my personal account and my personal ssh private key on my central management server.

Sources :

Officiale documentation Ansible :


Hi, I'm Florian and I'm 32 years old. I have discover IT at 17, and i had my first internet connection at 23. So i'm not going to say that i was very precocious in this domain... PS : I 'm French, so please, be lenient with my english ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.