tasks/main.yml:
- name: configure
template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
owner: root
group: root
mode: 0644
notify: reload haproxy
...
frontend haproxy
bind {{ haproxy_listen_addr }}:{{ haproxy_listen_port }}
mode http
{% if haproxy_stats %}
stats enable
stats uri /haproxy?stats
stats realm HAProxy Statistics
stats auth admin:admin
{% endif %}
...
---
haproxy_listen_addr: 0.0.0.0
haproxy_listen_port: 80
haproxy_stats: true