Configuring Reverse
Proxy and update it’s configuration
file automatically on each time new Managed node join the inventory on local machine

This blog will explain you how to setup reverse proxy and to configure it automatically every time you attach new managed node.

Below are the machines I have launched according to above picture -

* Namenode -

rhel8_arth — 192.168/29.202 — machine on which ansible script will run.

* Datanode

rhel-exp-2– — machine on which haproxy will configure.

rhel-cli — — machine-1 on which web server-1 will run.

rhel-cl-2– — machine-2 on which web server-2 will run.

Now go to your namenode(rhel8_arth) machine and configure its inventory file by as -

Make a directory and put your yml file and cfg(configuration file of haproxy)

both file in that directory.

Below is the script …


Do the changes in haproxy.cfg.j2 file as show below.

I have used jinja code so that it can dynamically update it self to configure haproxy.

Bind keyword as shown in below rectangle shows that haproxy runs on 8081 port number.

second rectangle is use to update ip address of the instances where web server runs.

After all above configuration run the script

ansible-playbook lb.yml

As the script runs successfully, now go to instance where you run haproxy server and web servers and check their status by the command —

systemctl status haproxy
systemctl status httpd
instance running haproxy
instance running web server 1
Instance running web server 2

Now go to browser and check whether haproxy server is running or not


Thank you

Harsh Agrawal




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

Recommended from Medium

Torah AMA: Web3 with Distributed Storage

AWS Docker Gitlab Serverless - The easy way.

Photo form:

7 Agile Project Management Tools that you should Know

Java Lombok Tutorial by OnlineTutorials

Docker : In Layman Terms

How to Easily Explore a Python Library With Real Data


Fundamentals of networking in AWS

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
Harsh Agrawal

Harsh Agrawal


More from Medium

Adding features to Sphero Pong

Needed: Financing Policies That are Both Affordable AND Sustainable

Intermezzo: A Kew Gardens Fall/Winter Meditation

Naim Audio — Servicing & DR Upgrades