1 - Control Node
2 - Managed Nodes
Note: Connect to all 3 VMs using MobaXterm
sudo useradd ansible
sudo passwd ansible
sudo visudo
ansible ALL=(ALL) NOPASSWD: ALL
sudo vi /etc/ssh/sshd_config
-> comment PasswordAuthentication no -> PermitEmptyPasswords yes
sudo service sshd restart
Note: Do the above steps in all the 3 machines
sudo su ansible
cd ~
sudo yum install python3 -y
python3 --version
sudo yum -y install python3-pip
pip3 install ansible --user
ansible --version
sudo mkdir /etc/ansible
sudo su ansible
ssh-keygen
ssh-copy-id ansible@<ManagedNode-Private-IP>
Ex : $ ssh-copy-id [email protected]
Note: Repeat above command by updating HOST IP for all the managed Servers.
sudo vi /etc/ansible/hosts
[webservers]
172.31.47.247
[dbservers]
172.31.44.90
ansible all -m ping