Let’s configure haproxy on AWS cloud 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.

So what is the solution?

Load Balancer

Let’s do the configuration

Whenever we are automating any task we need to have a proper plan about what we want to achieve.

Configuring the reverse proxy

For configuring the system as haproxy server we need to do the following tasks:

  1. Install the haproxy server software
  2. Configure the configuration file of the haproxy
  3. Start the services

Configuring the web server

The steps of configuring the web server node are as follows:

  1. download the apache web server software
  2. download the python software
  3. copy the content we want to host on the server
  4. set the permissions of these files transferred so that the user can execute them
  5. start the web server

Conclusion

The task we did today might seem very simple but in real industry use case it is a very important task. Automating these tasks is very important since it is very difficult to manage so many tasks manually. Automation also makes these tasks less prone to errors and even they are bugged it is easier to detect the issue since all the configuration files can be found in a localised system.

--

--

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