haproxy_loadbalancer
Ansible-Haproxy-Role
Lets understand the Problem Statement:
- Create an Ansible Role to Install Haproxy LoadBalancer Software on Remote system.
- Dynamically update the Haproxy configuration file with BackEnd Webserver IP Addresses.
- Start Haproxy LoadBalancer Service and make Haproxy LoadBalancer Service permanent on reboot.
- Add Idempotence to Haproxy LoadBalancer such that on new Changes are made to Haproxy LoadBalancer Configuration file, Haproxy LoadBalancer Service restarts automatically.
To replicate same setup on your Local Machine perform following steps:
- Install Ansible on local system and this local machine acts as
Master Node
. - Clone this repository on Local Machine and edit
ansible.cfg
file to add up location where our Role is present usingroles_path
keyword. - Now create Inventory File and Playbook for running this role.Specify Inventory Location in Inventory using
inventory
. - Note that Inventory File must have all Webserver IP Addresses/Domain Name under HostGroup Name
webserver
and all LoadBalancer IP Address/Domain Name under HostGroup Nameloadbalancer
. - Edit
Ansible-Haproxy-Role/vars/main.yml
file to tell about Exposed Haproxy LoadBalancer Port Number using variableexposed_port_number
. - Edit
Ansible-Haproxy-Role/vars/main.yml
file to tell about Backend Webserver Port Number using variablewebserver_port
Finally all things set so it's time to Deploy above complete setup and run below command:
ansible-playbook
About
An Ansible Role to setup Haproxy Loadbalancer.
Install
ansible-galaxy install shubhambhardwaj007/Ansible-Haproxy-Role
License
gpl-3.0
Downloads
33
Owner
Cybersecurity researcher | Hybrid Multi Cloud | Openstack | AWS EKS | DevOps | Docker | Kubernetes | Jenkins |AWS | Terraform