First, make sure that your system is up to date, and add the Ansible channel. Finally, install the Ansible package itself, as shown in the following snippet:
$ sudo apt-get update $ sudo apt-get install software-properties-common $ sudo apt-add-repository ppa:Ansible/Ansible $ sudo apt-get update $ sudo apt-get install Ansible
For more installation flavors, you can check the official Ansible website (http://docs.Ansible.com/Ansible/latest/installation_guide/intro_installation.html?#installing-the-control-machine).
You can validate your installation by running Ansible --version to check the installed version: