Install and Configure Ansible on Ubuntu 20.04 guide

Steps to Install and Configure Ansible on Ubuntu 20.04

Ansible is famous for Configuration Management and Application Deployment system. It allows you to control a large number of remote machines in an automated fashion from one central location.

Before you install the Ansible control machine and ansible nodes we need to set up an SSH connection for the two servers.So, you can refer to our blog to establish communication between two servers using SSH.

Install Ansible:

1. To install Ansible, update the machine.

To install Ansible, update the machine.

2. Add the PPA ansible repository to your local.Add the PPA ansible repository to your local.

Add the PPA ansible repository to your local.2

3. Later press ENTER to continue.

4. Now, you can install ansible by running the following command.

Now, you can install ansible by running the following command.

Now, you can install ansible by running the following command.2

5. Enter "Y" to continue the next step.

6. Verify the Ansible version.

Verify the Ansible version.

7. Now the Output will be displayed like this

Now the Output will be displayed like this

Inventory setup:

Setup an inventory file of remote hosts to enable Ansible to communicate with them. To enable access, use the following command in the ansible master.Inventory setup

When executing the above command, the output of the vi-editorwill open. Now, you can add or remove hosts from the inventory file. The sample inventory file looks like below. 

inventory file

Now, you can add the Web host group under this we can add our node private IPs.

[testservers]

172.31.34.103

You can list out your host nodes using the below commands.

You can list out your host nodes using the below commands.

The output of the inventory list.

The output of the inventory list.

Test your connection:By using the PING module, we can test our node connection on the control machine by using the following command.

~# ansible all -m ping

 we can test our node connection2

Summary: Thus, the steps required for complete installation and configuration of Ansible on Ubuntu 20.04, inventory setup, testing connection methods are clearly explained with the commands.