Deploying Web Server on AWS through ANSIBLE.

Deploying Web Server on AWS through ANSIBLE.

Task2:

* Provision EC2 instance through ansible.

*Retrieve the IP Address of instance using a dynamic inventory concept.

*Configure the webserver through ansible!

Amazon Web Services:

Amazon Web Services (AWS) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. These cloud computing web services provide a variety of basic abstract technical infrastructure and distributed computing building blocks and tools. One of these services is Amazon Elastic Compute Cloud (EC2), which allows users to have at their disposal a virtual cluster of computers, available all the time, through the Internet.

Steps to provision EC2 instance through ansible.

1 ). we have to set up an Ansible environment in our system. For doing anything on the aws using the local system with the help of ansible then you have to install boto library of python

No alt text provided for this image

2). Create ec2 instance on aws from control node.We have to write playbook as follow.

No alt text provided for this image

*As we can show our aws access key and secret key so we need one more new.yml file which include all keys.To create new.yml file we used:

No alt text provided for this image

*keys included in new.yml file as:

No alt text provided for this image

*To check new.yml file encrypted or not use:

No alt text provided for this image

3). now run launch.yml file to launch ec2 instance.

No alt text provided for this image

check ec2 launched or not:

No alt text provided for this image

Steps to retrieve the IP Address of instance using a dynamic inventory concept.

1). first we have to download python code from github using wget which fetch ip addresses

now make them executable as:

No alt text provided for this image

2 . To initiate these ec2.py and ec2.ini file we have to export ini file path, access key, secret key as:

No alt text provided for this image

3 . Now configure the inventory as py file fetch the ip by dynamic inventory concept.

No alt text provided for this image

4 . Check target host pinging:

No alt text provided for this image

Steps to configure the webserver through ansible:

1. write playbook for webserver configuration on ec2 instance as:

No alt text provided for this image

2. Run this playbook :

No alt text provided for this image

webserver has been deployed succesfully.

3 . Here our ec2-instance configure successfully, now check the web-browsers:

No alt text provided for this image


THANKYOU...



To view or add a comment, sign in

More articles by Sagar Gavhane

Others also viewed

Explore content categories