In this series of Ansible we’ve already seen Introduction to Ansible its uses and advantages, Ansible Architecture and how does it work, In this post we will be seeing how to Install Ansible. We will be installing Ansible in EC2 linux machine CentOS.
So let’s get started with practical.
Login to AWS Console, create 2. t2 micro system.
Login to Ansible server and run below commands to install ansible
sudo apt update sudo apt install software-properties-common sudo apt-add-repository --yes --update ppa:ansible/ansible sudo apt install ansible
Verify ansible version and python version
Now login to Ansible node and install python, run below commands,
sudo apt update sudo apt install software-properties-common sudo apt-add-repository --yes --update ppa:ansible/ansible sudo apt install python
Verify the installation of Python, make sure you do not install Ansible on nodes,
Now login to Ansible master and generate private-public key pair to login to nodes, Run below commands to generate keys,
ssh-keygen -t rsa
Now navigate to .ssh folder and copy the content of id_rsa.pub from master and paste in the authorized_keys of node machines.
This will enable ssh keys based seamless authentication
Now open the default inventory file located in master by
Now add the servers as shown below, I’ve added my server in group appservers.
Now save the file and run below commands to check whether the node is connected or not, you should get below reply.
$ ansible appservers -m ping
Here you’re! You’ve successfully installed Ansible server and attached the node to Ansible server
Do let me know in the comment section if you face any queries.