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 over AWS using instance over there.

Ashish Mangal
2 min readMar 28, 2021

In this article I would like to show you a practical how you should configure webserver and load balancer on the top of AWS instances.

Solution-:

Step1: Firstly launch three instances one is controller node and other are two managed nodes. In controller node install ansible and we configure the ansible configuration file. For this go to the ansible.cfg file-:

vi /etc/ansible/ansible.cfg

Step2: Create a workspace and write a website code either in html or in php or in some other frontend languages.

Check the connection using ping command-:

ansible all -m ping

Step3: Create a jinja template of HAProxy.cfg file which automatically do the necessary changes like its port number and other information.

Step4: Now create a ansible playbook to configure webserver and load balancer-:

Step5: RUN the playbook using the command-:

ansible-playbook {filename}.yml

Step6: In this way we configure the load balancer and webserver and check the result in the browser by writing the IP/{name}.

Thank you 😊😊

--

--

Ashish Mangal
0 Followers

My name is Ashish Mangal. Currently I am pursuing B.tech in Electronics and Communication. A Technology Enthusiast!!!