DevOps(Day-59): Ansible Project 🔥
TABLE OF CONTENTS
Ansible playbooks are amazing, as we learned yesterday. What if we deploy a simple web app using Ansible, sounds like a good project, right?
Task: Creating a Webpage through Ansible
Create 3 EC2 instances and make sure all three are created with the same key pair.
Three servers are created that include Ansible master and node servers.
Install Ansible on the host server
Create the ansible repository in the master server.
Install Ansible through apt in the master server.
copy the private key from local to the Host server (Ansible_host) at (/home/ubuntu/.ssh)
Copy the private key that you have created while creating the server.
Create an ansible key file and store the above private key.
Provide access permission for the key file.
access the inventory file using sudo vim /etc/ansible/hosts
Create the inventory file in the master server to link the node servers to the master server.
Create a playbook to install Nginx
Create a playbook to install, start and enable the Nginx in both the node servers.
Execute the ansible-playbook yaml file to perform the task.
deploy a sample webpage using the ansible-playbook
Create a webpage index.html file in the master server.
Modify the ansible-playbook to transfer the index.html file to the Nginx location.
Execute the ansible-playbook to execute the webpage.
Login to the first node server to check the webpage.
Login to the second node server to check the webpage.
Subscribe to my newsletter
Read articles from Biswaraj Sahoo directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Biswaraj Sahoo
Biswaraj Sahoo
--AWS Community Builder | DevOps Engineer | Docker | Linux | Jenkins | AWS | Git | Terraform | Docker | kubernetes Empowering communities via open source and education.