ansible-haproxy icon indicating copy to clipboard operation
ansible-haproxy copied to clipboard

haproxy.cfg tidy and all no backend mode if backend.status exists

Open sol1-matt opened this issue 4 years ago • 2 comments

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

sol1-matt avatar Apr 29 '20 04:04 sol1-matt

#80 is merged

tersmitten avatar May 19 '20 14:05 tersmitten

All "tidy" changes can be removed

tersmitten avatar May 19 '20 14:05 tersmitten