HOW TO INSTALL ANSIBLE ON AWS EC2 INSTANCE

coding script
Reading Time: 3 minutes

Hello Readers! You all must have heard about Ansible and AWS EC2. So, In this blog we will see how you can install ansible on AWS EC2 instance.

Ansible is a configuration control automation tool, this is used to manipulate faraway machines. Ansible works with the aid of using going for walks instructions through SSH, so there`s no want to put in any server software.

Installing Ansible

Here are some of the easiest steps to install on AWS EC2. So, let’s get started.

Step-1: First you need to Login into your AWS Console, and then go to ec2 instances and launch an Ubuntu instance.

HOW TO INSTALL ANSIBLE ON AWS EC2 INSTANCE

STEP 2: Choose the instance type as t2 micro, no of instance 1, and keep rest of the thing as default.

HOW TO INSTALL ANSIBLE ON AWS EC2 INSTANCE

STEP 3: select an Existing OR Create a new Key Pair and give that key pair name as of your choice in order to find it easily and then click on download button.

After that the Key Pair gets download in you local machine in the Downloads Directory,and then click on launch instance. Your instance starts launching.

HOW TO INSTALL ANSIBLE ON AWS EC2 INSTANCE

STEP 4: Once the instance is launch you will see something like this :

HOW TO INSTALL ANSIBLE ON AWS EC2 INSTANCE

STEP 5: got to the directory where you download the .pem file and by default you find your pem file in the Downloads Directory.

Chane the Permission of that .pem file by using the command:

chmod 400 Ansible.pem

STEP 6: After changing the permission get ssh into the ec2 instance and click on ssh client, and type “yes” while connecting through the console as:

ssh -i "Ansible.pem" ubuntu@ec2-54-161-55-228.compute-1.amazonaws.com
sudo apt-get update

STEP 8: Run the following command to install it into AWS EC2 Instance

First of all we need to install python in out system to run it smoothly

sudo -i

apt-get install python-minimal

apt-get install python3

python3 --version

STEP 9: Now we install ansible as follows:

sudo -i

apt-get update

apt-get install software-properties-common

apt-add-repository ppa:ansible/ansible

apt-get update

apt-get install ansible
ansible --version

Conclusion

In this blog, we’ve seen how to launch the ec2 instance and its configuration for Ansible and how we can install Ansible on it, after that, we are able to access the Ansible

Reference

Click here

knoldus

Written by 

Deeksha Tripathi is a Software Consultant at Knoldus Inc Software. She has a keen interest toward learning new technologies. Her practice area is DevOps. When not working, she will be busy in listening music , and spending time with her family .