HAProxy configuration Using Ansible
LOAD BALANCER :
Load balancing is the process of distributing workloads across multiple computing resources. Servers generally have a specific limit to the number of clients they can serve , so if the limit is reached and a new client access the site , some errors will come and this may impact reputation of the company.
Haproxy :
HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers. It is written in C and has a reputation for being fast and efficient.
🔰 Task Description 📃
12.1: 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.
🔰 STEPS :
- Create a setup , one as controller node , one for load balancer and one for backend webserver.
Install haproxy in controller node , as we need config file of haproxy.
2. create inventory for load balancer and webserver, then
Check the connectivity using -
ansible all -m ping
3. Copy haproxy config file in the folder in which playbook is going to create .
Update haproxy config file using jinja keyword symbols.
4. Now create playbook .
for webserver :
for load balancer :
5. Now Run the playbook .
6. Now to check ,
haproxy is installed in load balancer
haproxy config file is automatically configured.
httpd software is installed and index.html file is also created in webserver …
Now , to check webpage using load balancer ip :