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.
1. To install Ansible, update the machine.
2. Add the PPA ansible repository to your local.
3. Later press ENTER to continue.
4. Now, you can install ansible by running the following command.
5. Enter "Y" to continue the next step.
6. Verify the Ansible version.
7. Now the Output will be displayed like this
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.
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.
Now, you can add the Web host group under this we can add our node private IPs.
You can list out your host nodes using the below commands.
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
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.