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.

Anjaliray
4 min readApr 18, 2021

--

What is reverse proxy server?

A proxy server is a go‑between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.

Common uses for a reverse proxy server include:

Load balancing — A reverse proxy server can act as a “traffic cop,” sitting in front of your backend servers and distributing client requests across a group of servers in a manner that maximizes speed and capacity utilization while ensuring no one server is overloaded, which can degrade performance. If a server goes down, the load balancer redirects traffic to the remaining online servers.
Web acceleration — Reverse proxies can compress inbound and outbound data, as well as cache commonly requested content, both of which speed up the flow of traffic between clients and servers. They can also perform additional tasks such as SSL encryption to take load off of your web servers, thereby boosting their performance.
Security and anonymity — By intercepting requests headed for your backend servers, a reverse proxy server protects their identities and acts as an additional defense against security attacks. It also ensures that multiple servers can be accessed from a single record locator or URL regardless of the structure of your local area network.

What is haproxy?

HAProxy is a high-performance, open-source load balancer and reverse proxy for TCP and HTTP applications. Users can make use of HAProxy to improve the performance of websites and applications by distributing their workloads. Performance improvements include minimized response times and increased throughput. HAProxy is used in high traffic services such as GitHub and Twitter.

Load balancers can be used to distribute workloads across computers, networks, disk drives or CPU’s. HAProxy, included in many distributions of Linux, is one of the leading standards in software load balancing.

Though HAProxy is open source, a commercial option is available through HAProxy Technologies, called HAProxy Enterprise.

Requirements

There are three machines which one of them work as Load Balancer Device and other two are work as Webserver (Means where application is hosted).

Load Balancer- rhel8server1- Ip:192.168.43.152

Webserver- redhat 8A- Ip:192.168.43.89

Webserver- redhat 8B- Ip: 192.168.43.26

Architecture

Our Setup

  1. Configure yum in all the system.

2. Install net-tools

3. Get IP’s of all the system.

At Loadbalancer
At redhat 8A(Webserver)
At redhat 8B(webserver)
At redhat 8B(webserver)

4. We have to update the IP’s with their login credentials in the inventory file.

5. We need to update the Haproxy configuration with the IP’s of the App Hosted Machines.

(Now all the steps are done using Ansible)

6. Install httpd service in all the Webserver node.

7.Upload the html page to shown when we browse the page through IP.

8. Install haproxy in the Loadbalancer.

9. Restart the httpd service

10. Stop firewalld

10. Execute the ansible playbook

11. Check the IP of the loadbalancer in the web browser.

Thank you😊

--

--

No responses yet