Ansible is an opensource automation tool used for configuration management and application deployment. It is used for configuring and deploying packages at a system remotely with the use of SSH and SCP protocols.
AWS provides a variety of services through its cloud platform. ec2 instances are dynamically allocated systems with customize-able configuration that enables us to host multiple system servers.
About the project:
The project aims at creating an Ansible playbook that makes uses of 2 roles that is used to log into the aws profile and launch ec2 instances and deploy Apache httpd server and host a web page.
boto3 and boto packages of python
ec2.py file that can be downloaded from here
Ansible configuration file needs to be updated to add the location of the role and the key file. The following changes are made at /etc/ansible/ansible.cfg file. The roles are created in /etc/ and the key file is kept at /root/task2/key.pem file.
Next step involves creating a role named myrole, that contains the tasks for logging into the AWS account with the access key and the secret key and then taking these information to the key.pem file and finally starting an ec2 instance of the given type in the given security group.
Then the playbook needs to be written names cloudlaunch.yml. This is the main file of the project and needs to be run, the other 2 roles are mentioned in this playbook and is used to give flow to the two roles mainly.
The boto and boto3 packages need to be installed next and the ec2.py file needs to be downloaded and its location updated in the inventory.
Next, the webserver role needs to be created and written. This is a basic playbook that installs the apache httpd package, copies a text into the /var/www/html folder and starts the service.
Finally the code is run and the playbook executes without any errors.
The webserver is successfully setup!