Introduction to Ansible

Ansible is similar to Chef or Puppet, as a configuration management and provisioning tool.

Unlike Puppet which relies on a management server and an agent installed on each machine you need to manage, Ansible is portable and can be run on any computer that has SSH access to the nodes that will be configured or provisioned as it just uses SSH to run tasks. Ansible is agentless.
There is no need for complicated scripts written in different languages such as Ruby, Perl or Python as even bash scripts can be easily used with Ansible as Ansible runs the same commands on the target nodes.

Ansible is therefore very clean, provided it's given some context (facts) it is able to run tasks that previously used to require complex scripts to achieve. Ansible is also able to determine whether a task needs to be run or not, previously with other tools such as Puppet, tasks are run regardless of whether they are needed (if a change is required or not). Ansible is able to determine whether a task is required which makes it safe to run unlike scripts that might break and cause corruption.

Alternatively you can also install Ansible inside a docker container, this is similar to a virtual environment as it separates Ansible from global changes to the host machine inside a virtual environment. This is useful if Ansible is used to run tasks on the local machine as global changes such as a change to one of Ansible's dependencies could cause Ansible to break.


Installing via the PPA ensures you are installing the latest stable version of Ansible. Alternatively, you can compile a package for your chosen OS via the official GIT repository.

Install globally via Ubuntu PPA repository
sudo apt-add-repository -y ppa:ansible/ansible  
sudo apt-get update  
sudo apt-get install -y ansible   

Ansible and Python dependencies will then be installed.
You can then verify Ansible is installed correctly by running

ansible --version

You should then get something like this:

ansible 2.5.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]