Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sol1-matt
Copy link

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

@@ -1,17 +1,30 @@
# {{ ansible_managed }}

#--#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we add lines like these and remove them afterwards?

- name: configuration | format file (remove empty)
lineinfile:
path: /etc/haproxy/haproxy.cfg
regex: '^\n'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to solve this in the template

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #80

@tersmitten
Copy link
Member

#80 is merged

@tersmitten
Copy link
Member

tersmitten commented May 19, 2020

All "tidy" changes can be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants