Provisioning HAProxy LoadBalancer and Webservers On AWS Using Ansible
Statement: Deploy a Load Balancer and multiple Web Servers on AWS instances through ANSIBLE!
🔅Provision EC2 instances through ansible.
🔅 Retrieve the IP Address of instances using the dynamic inventory concept.
🔅Configure the web servers through the ansible role.
🔅Configure the load balancer through the ansible role.
🔅The target nodes of the load balancer should auto-update as per the status of web servers.
Note: For Better Understanding Do read my previous post on Ansible
What is 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 and has a reputation for being fast and efficient (in terms of processor and memory usage). HAProxy is used by a number of high-profile websites including GoDaddy, GitHub, Bitbucket, Stack Overflow, Reddit, Slack, Speedtest.net, Tumblr, Twitter and Tuenti and is used in the OpsWorks product from Amazon Web Services.
Step1: Create Ansible Playbook for webservers and load balancer.
Step2: On Local system,edit HAProxy config file.
Step3: Save the Playbook and Execute it.
Command to execute Playbook:# ansible-playbook <YML-File>
- Playbook for Webserver:
2. Playbook for Proxy server
So our playbook successfully run
Lets take a look at EC2 Dashboard of AWS