Arth Task: 12.2

kanav Gupta
2 min readMar 2, 2021

--

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 on AWS EC2.

Reqirements:

AWS EC2 instances(1 as controller node and other two as managed node) and pre insatlled ansible in controller node

To run cmd on AWS while running ansible playbook, it should run with root power for this we have to provide privilege escalation in configuration file of ansible:

Inventory file:

Creating a jinja file for haproxy.cfg with extension .j2 which will create the configuration file dynamically:

Ansible-playbook:

Also the configuration file of haproxy here the ip is dynamically updated of managednode:

Now adding one more Managednode into inventory file of our backened server:

Running the playbook:

Configuration file of haproxy(host) is dynamically updated with added new targetnode:

At target node(new) the httpd services started with port no 80:

output of web page access through target nodes as:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response