ansible-haproxy
ansible-haproxy copied to clipboard
haproxy.cfg tidy and all no backend mode if backend.status exists
These commits
- tidy the haproxy.cfg to make it easier for humans to read by removing excess blank lines and adding headings for sections. Outputs like below
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
# Userlist
# Listen
# Frontend
frontend http
bind 0.0.0.0:80
mode http
use_backend foo if { hdr(host) -i foo.com }
use_backend bar if { hdr(host) -i bar.com }
# Backend
backend foo
description dnsdist
mode http
balance roundrobin
server foo-server 127.0.0.1:5380
backend bar
description powerdns recursor
mode http
balance roundrobin
server bar-server 127.0.0.1:5381
- allows the skipping of a backend mode so long as backend.status is set
ansible vars
- name: stats
stats:
enable: true
uri: /
options:
- show-desc
refresh: 5s
admin: if TRUE
haproxy.cfg
backend stats
stats enable
stats uri /
stats refresh 5s
stats admin if TRUE
stats show-desc
#80 is merged
All "tidy" changes can be removed