Install Ansible on Debian 9 Stretch from source

Install Ansible 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 build-essential git python-setuptools python-dev libffi-dev openssl libssl-dev

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.4 “Dancing Days”).

Release note of Ansible 2.4 :

root@ansible:/usr/local/src/ansible# git checkout stable-2.4
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.

V – Test Ansible

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

admin_florian@ansible:~$ ansible --version
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-
executable location = /usr/local/bin/ansible
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

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.