ARTH — Task 12 👨‍💻

12.1 Use Ansible playbook to Configure Reverse Proxy i.e. Haproxy and update it’s configuration file automatically on each time new Managed node (Configured With Apache Webserver) join the inventory.

12.2 Configure the same setup as 12.1 over AWS using instance over there.


|| NOTE: Create an AWS account

STEP:1: To download the dynamic inventory requirements…

STEP:1.1:Download ec2.ini and files

To download ec2.ini file:wget download file:wget

STEP:1.2: Install packages

pip3 install boto
pip3 install boto3
pip3 install ec2

STEP:1.3:To make it executable

chmod +x
chmod +x ec2.ini

STEP:2:Access key and Secret key….

STEP:2.1:Get IAM user access key and secret key

1.Go to Security, Identity, & Compliance → IAM
2.IAM Resources -> users -> Add User
3.set permissions -> Attach existing policies directly -> PowerUserAccess -> Create user

STEP:2.2:Create a file with the extension (.yml) and save these two key

cmd: <filename>.yml

STEP:2.3:Update ec2.ini and files

1.create a inventory path(for easy access) : mkdir /inventory /inventory
3.move the files (ec2.ini, into this dir.
cmd: mv ec2.ini /inventory
mv /inventory

||STEP:2.3.1:Open ec2.ini file

cmd: vim ec2.ini

Now, update the access key and secret key in “[credentials]” part

||STEP:2.3.2:Open file

cmd: vim

STEP:2.4:Now export both the key


Now, change access permission

cmd: chmod 400 <filename>.yml

STEP:3:Set your ansible configuration file…


  1. Create the private key file using puttygen.
  2. Copy the private key file to the os in which your gonna run the ansible-playbook.[using winSCP]

STEP:4:Install haproxy and update config file…

||Install haproxy

cmd: yum install haproxy

||update configuration file

cmd: vim /etc/haproxy/haproxy.cfg

STEP:5:Write the ansible-playbook…

STEP:5.1: to launch web server and load balancers over AWS…

||vim ec2.yml

STEP:5.2: to do necessary work within launched webserver and load balancer

||vim haproxy.yml

STEP:5.3: to provide necessary instances details

||vim variable.yml

STEP:6: Run the ansible-playbook…

STEP:6.1: Run ec2.yml :: to launch ec2 instances

Note ::

To check:
*ansible all --list-hosts
*ansible all -m ping

STEP:6.2: Run haproxy.yml

STEP:7: Final step -to check the website….

cmd: <loadbalancer_ip>:8080





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My Must-Have 🐍 Python Cheat Sheets

VSCode CSS Shortcuts: Least Strokes is the Best Stroke

DataStructure Quick Notes: AVL Tree

Managed IT Services in Wiltshire #Managed #IT #Services #Wiltshire

Here Are Some of the Best Resources to Improve Your Coding Skills

The 8 most common mobile features testing problems

How to Install easily Spark for Python

Getting started with Azure DevOps

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Saranya. S

Saranya. S

More from Medium

*#/ GM 0208 — Overview

This is an informal post about how scared I am to start posting more content on here.

‘Yellow Cab’ by DPR LIVE: A Refreshing Search for Recognition

WEEK 2 ( by Puan Noor Hasimah )