The following playbook will set up three nodes, which includes load balancer and two web server nodes. Follow https://www.upcloud.com/support/haproxy-load-balancer-ubuntu to create a playbook.
The following snippet is the inventory file:
[proxyserver]proxy ansible_host=192.168.100.100 ansible_user=ubuntu ansible_password=passwordgoeshere[blue]blueserver ansible_host=192.168.100.10 ansible_user=ubuntu ansible_password=passwordgoeshere[green]greenserver ansible_host=192.168.100.20 ansible_user=ubuntu ansible_password=passwordgoeshere[webservers:children]bluegreen[prod:children]webserversproxyserver
Then, the main.yml playbook file looks like the following, which describes what roles to execute on which ...