HAProxy is one of the most powerful open-source load balancers, widely used for its reliability, security, and performance. The Data Plane API adds a REST API to manage its configuration. Installing both by hand means a repository, a pinned package, a binary from GitHub, two config files and a systemd unit, on every load balancer.
This post walks through one Ansible playbook that does all of that, from the official HAProxy repositories, and gives the same result on every run.
Why Ansible for this?
Repeatable - Every load balancer gets the same packages, files and service
Version control - Change haproxy_version or dataplaneapi_version and rerun to upgrade
Idempotent - A second run reports no changes, so you can run it at any time
When to use it
Use it for more than one load balancer, or for one you want to rebuild quickly.
Skip it for a single throwaway test box; the manual steps in the Data Plane API post are quicker.
Architecture Overview
Component Comes from Job
HAProxy vbernat/haproxy-X.Y PPAβ¦