Use Ansible playbook to Configure Reverse Proxy i.e. Haproxy and update it’s configuration file
What is Ansible?
Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.
Every business is a digital business today. Technology is the innovation engine, and delivering your applications faster helps win. Historically, that required a lot of manual effort and complicated coordination. But today, there is Ansible — the simple, yet powerful IT automation engine that thousands of companies are using to drive complexity out of their environments and accelerate DevOps initiatives.
What is LoadBalancer?
Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.
A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.
In this manner, a load balancer performs the following functions:
- Distributes client requests or network load efficiently across multiple servers
- Ensures high availability and reliability by sending requests only to servers that are online
- Provides the flexibility to add or subtract servers as demand dictates
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). It is used in many high-profile environments, including GitHub, Imgur, Instagram, and Twitter. HAProxy acts as a Proxy server, as well as a LoadBalancer.
Now we have to install Ansible software in control node.
For this please visit below blog
After installation create inventory file as
Now run command #ansible all — list-host It will show list of IPs of all target node
Now to check connectivity with target node use command #ansible all -m ping
Connectivity to all the Managed Node looks good.
Now we have to create configuration file for haproxy as haproxy.cfg.j2. In that file we have to made some changes so that if we add extra ip of server in inventory file then load balancer can get this ip automatically.
Final Playbook :
For playbook visit this link
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build…
Our Playbook is running successfully.
Any Suggestion Is Valuable Fell Free To Ask.😊
Thanks for reading, I’ll meet you in the next one! 🎯