Ansible is a free and open-source automation tool used to configuration management, application deployment and task automation. We at Skynats do Ansible automations for various tasks under our Server Management plan.
To install Ansible on your server, run the following command on your control node:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
Verify the installation by using the command
sudo ansible --version
After that, create a user to perform Ansible tasks on both the control and managed node and give the sudo permissions.
sudo adduser ansible
Configure password less authentication for the created user from control node to managed nodes. For that, generate an SSH key pair and copy it to the managed nodes using the following commands.
ssh-keygen
ssh-copy-id [email protected]
Then, add the managed nodes IP addresses to the Ansible inventory file located in the /etc/ansible directory.
vim /etc/ansible/hosts
Add managed nodes IP addresses, then save and quit the inventory file. To list the managed nodes added in above step, run the command
ansible all -i hosts --list-hosts
All managed nodes added will be listed as shown below
We have now completed the Ansible installation and configuration. Next, we can verify the configuration by using the ping command from the Ansible control node to ensure that the managed nodes are available.
ansible -m ping all
If the output displayed was success, which means that managed nodes are available and we can perform the tasks using Ansible automation tool.
Our Technical Team will be available to assist you with Ansible automation tool services that can make your job a lot easier. Get in touch with Skynats if you have any queries.