Ansible is well-known for Configuration Management and Application Deployment system. It allows controlling a large number of remote machines in an automated fashion from a self-centered location. However, we can save space and time while Ansible installation and configuration.
Before you install the Ansible control machine and nodes for SSH connection, refer to this blog to know how 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
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.
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.
[testservers]
172.31.34.103
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: The above steps lead to the successful setup, installation, and configuration of Ansible on Ubuntu 20.04. Additionally, this blog detailed the steps required for inventory setup, testing connection methods, and commands.
Technologywe use