How to install Ansible on Ubuntu 16.04/18.04 LTS

Ansible is an open-source programming provisioning, arrangement the board, and application-organization instrument empowering foundation as code, It runs on numerous Unix-like frameworks, and can design both Unix-like frameworks just as Microsoft Windows. It incorporates its own definitive language to depict framework design. Ansible was composed by Michael DeHaan and obtained by Red Hat in 2015. Ansible is agentless, briefly interfacing distantly through SSH or Windows Remote Management (permitting far off PowerShell execution) to finish its undertakings.

In  this post, We will install and configure Ansible on ubuntu 16.04/18.04 LTS

Step 1: Installing Dependencies
Ansible required few packages to perform well, Use the given command for the same.

sudo apt-get update

sudo apt-get install aptitude -y

Step 2: Adding Repository
You need to add the Ansible repository on ubuntu by using the given command.

sudo apt-add-repository ppa:ansible/ansible 

Step 3: Installing Ansible
Now we need to update the ubuntu current repository and install the Ansible by using the following command.

sudo apt-get update
sudo apt-get install ansible -y

Step 4: Verify the Ansible Version

You need to execute the given command to get Ansible version.

ansible --version

You can also use the bash shell script to install the Ansible package on ubuntu 16.04 and 18.04 also.


paste the given code in file and execute it.


sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install aptitude -y
sudo apt-get install ansible -y


 Save and exit from the vim text editor and use the following command to run it.


Here you can find the Ansible main configuration files path and details.
Ansible main configration file      –   /etc/ansible/ansible.cfg
Ansible Host configuration file     –  /etc/ansible/hosts
Ansible Roles configuration path  –  /etc/ansible/roles
Step 5:Basic configuration in Ansible

By default host host key checking enable in Ansible fresh installation, You need to update it false in /etc/ansible/ansible.cfg  To do that you need to follow given steps.

sudo vim /etc/ansible/ansible.cfg

And add the given configuration in [default] bloack like this.

host_key_checking = false

Sample output.

 Save  and exit from the vim text editor, After this you need to add python3 default environment in ansible host file, You need to open the /etc/ansible/hosts file and add the following python3 interpreter.

sudo vim /etc/ansible/hosts

Add the given configuration in the last line.


Sample output.

Save and exit from the vim text editor, Here our basic Ansible configuration is completed.

How to install Ansible on Ubuntu 16.04/18.04 LTS

Leave a Reply

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

Scroll to top