Configure haproxy using ansible

  • firstly all these different web servers have different IP hence if the user want to connect to them the he would have to remember all these IP address which is not practical since some websites have thousands of servers.
  • not all web servers are busy at all times and the user would have to check the traffic on different web servers before connecting. Again this is not a very time-efficient way of managing things.

What’s a load balancer?

Let’s automate this process

Haproxy is one of the software that allows us to create a reverse proxy or load balancer. So today I would be using it as the software.

  1. Download and install the haproxy software
  2. Configure the haproxy configuration file
  3. Limit the firewall which might hamper the connection of the webservers to the load balancer
  4. Start the haproxy services.

1. Install the haproxy software

2. Create the configuration file


Today we automated the creation of the reverse proxy. We actually dived in the backend of how things actually work and also understood why we need this type of server in today’s world. This concept would be under utilized if it is not automated since we usually have to deal with large number of servers in the real scenarios.



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