Please visit my website and subscribe to my youtube channel for more articles
For Ansible to work,python and SSH should be configured on all the servers
Prerequistie
Python
SSH
On AWS EC2 Linux Free Tier Instance, python and ssh both are already installed
Python Version — 2.7.13
Three servers
Ansible control Server ( Install ansible using epel repository)- On AWS you have to enable this file
WebServer
DBServer
How to connect between these servers ?
To ping these servers(webserver and dbserver) from ansible control server , you have to add one inbound rule “All ICAMP traffic” in both the instances)
Ansible Control Server
Install Ansible on Redhat
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -ivh epel-release-latest-7.noarch.rpmyum repolistyum --enablerepo=epel install ansible
Install Ansible on AWSLinux
vim /etc/yum.repos.d/epel.repoorsudo yum-config-manager --enable epel
yum repolist ( you should see epel)
yum install ansible
Create an entry for all servers in etc/hosts file as shown below
vim etc/hosts
Create one user “ansadm” on all the servers as shown below
After adding you have to do ssh by login as ansadm user. You will get the below error , because…