Hello everyone,
In this article, we are going to configure HAProxy using Ansible in AWS,
So let's get started...
I have launched three instances in aws👇
Configuration of Control Node:
Install Ansible in Control Node
To install Ansible use command pip3 install ansible and then install sshpass using command yum install sshpass
Create Inventory
After installing Ansible create an Inventory anywhere in the system, here I have created an inventory named ip.txt and inside inventory put Managed Node username, Password, and the connection type.
Here I have created group one of the load balancer and other of Backend Server.
Check the connectivity of Managed Node
To check connectivity using command ansible all -m ping.
Create Ansible Configuration file
Create Playbook
Configure Haproxy file
- Before we run the playbook lets check first is Haproxy is installed in the Control node or not, to check that use command rpm -q haproxy
Here we can see Haproxy is not installed.
Run the Playbook.
- now check Haproxy is installed in the Control node or not
Here you can see Haproxy is installed and launched successfully...
- Check in Managed node is webserver configured or not
Here you can see it is configured successfully...
Check Haproxy or Load balancer is working or not
Here you can see it is working...🙌
So that's how we can configure Haproxy in AWS using Ansible...
Thank you!❄
Top comments (0)