Configuring HAproxy Load Balancer using Ansible

What is HAproxy

HAProxy, which stands for High Availability Proxy, is a popular open source software TCP/HTTP Load Balancer and proxying solution which can be run on Linux, Solaris, and FreeBSD. Its most common use is to improve the performance and reliability of a server environment by distributing the workload across multiple servers (e.g. web, application, database).

Configuring Load Balancer and App server using Ansible playbook:

First we will have to add 2 different groups in the inventory.

  • Web-server group
  • Load-balancer group