Configure Ansible On Different Machines
Step 1 : Create a master node . Here open SSH port and also use a master key .
Step 2 : Create a worker node . Here open SSH and HTTP port , and also use a worker key.
Step 3 : Connect master node using SSH and install ansible on this .
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
Step 4 : Now copy the private key of worker node into the master node . Here use the command below to copy the private key into the home directory .
scp -i "Ansible-master.pem" Ansible-worker.pem ubuntu@ec2-54-146-224-195.compute-1.amazonaws.com:/
Step 5 : Now make some changes in the ansible configuration file . Here assign host_key_checking to False .
sudo su
ansible-config init --disabled -t all > ansible.cfg
vi ansible.cfg
Step 6 : Grant the read permission to the private key of worker node that is present inside the master node .
chmod 400 Ansible-worker.pem
- Now you have successfully configured Ansible on a worker machine . You can now write custom playbooks to automate the tasks on the worker node .
How to install Ansible in AWS EC2 Server ?
Ansible is an automation tool which helps in managing the configuration over multiple machines . On the other hand AWS EC2 is a web service which allows users to rent any required virtual server . Here in this guide, we will first discuss what is Ansible. Then we will discuss AWS EC2 Service. After this, we will walk you through the different steps to install and configure Ansible on an AWS EC2 server.