Skip to content

Commit

Permalink
Merge pull request #51 from mujx/server-template
Browse files Browse the repository at this point in the history
Add support for server-template
  • Loading branch information
goldyfruit authored Jan 20, 2022
2 parents 3040989 + edcf1b2 commit 5d9f014
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ haproxy_backend:
balance: source
bind_process:
- 1
server_templates:
- srv 3 service.local:80 check resolvers mydns init-addr none
servers:
- ctrl01 10.0.0.67:80 check inter 2000 rise 2 fall 5
- ctrl02 10.0.0.68:80 check inter 2000 rise 2 fall 5
Expand Down
5 changes: 5 additions & 0 deletions templates/etc/haproxy/haproxy-backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ backend {{ name }}
compression {{ compression }}
{% endfor %}
{% endif %}
{% if value.server_templates is defined %}
{% for srv_tmpl in value.server_templates %}
server-template {{ srv_tmpl }}
{% endfor %}
{% endif %}
{% for srv in value.servers %}
server {{ srv }}
{% endfor %}
Expand Down
2 changes: 2 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
balance: source
bind_process:
- 1
server_templates:
- srv 3 service.local:80 check resolvers mydns init-addr none
servers:
- ctrl01 10.0.0.67:80 check inter 2000 rise 2 fall 5
- ctrl02 10.0.0.68:80 check inter 2000 rise 2 fall 5
Expand Down

0 comments on commit 5d9f014

Please sign in to comment.