summaryrefslogtreecommitdiffstats
path: root/roles/haproxy
diff options
context:
space:
mode:
Diffstat (limited to 'roles/haproxy')
-rw-r--r--roles/haproxy/defaults/main.yml3
-rw-r--r--roles/haproxy/templates/haproxy.cfg.j225
2 files changed, 26 insertions, 2 deletions
diff --git a/roles/haproxy/defaults/main.yml b/roles/haproxy/defaults/main.yml
index c002efdbc..16e9af4d1 100644
--- a/roles/haproxy/defaults/main.yml
+++ b/roles/haproxy/defaults/main.yml
@@ -1,7 +1,8 @@
---
haproxy_frontends:
- name: main
- bind: "*:80"
+ binds:
+ - "*:80"
default_backend: default
haproxy_backends:
diff --git a/roles/haproxy/templates/haproxy.cfg.j2 b/roles/haproxy/templates/haproxy.cfg.j2
index bfcdcfdb1..fddf0ede1 100644
--- a/roles/haproxy/templates/haproxy.cfg.j2
+++ b/roles/haproxy/templates/haproxy.cfg.j2
@@ -35,13 +35,36 @@ defaults
{% for frontend in haproxy_frontends %}
frontend {{ frontend.name }}
- bind {{ frontend.bind }}
+{% for bind in frontend.binds %}
+ bind {{ bind }}
+{% endfor %}
default_backend {{ frontend.default_backend }}
+{% if 'mode' in frontend %}
+ mode {{ frontend.mode }}
+{% endif %}
+{% if 'options' in frontend %}
+{% for option in frontend.options %}
+ option {{ option }}
+{% endfor %}
+{% endif %}
+{% if 'redirects' in frontend %}
+{% for redirect in frontend.redirects %}
+ redirect {{ redirect }}
+{% endfor %}
+{% endif %}
{% endfor %}
{% for backend in haproxy_backends %}
backend {{ backend.name }}
balance {{ backend.balance }}
+{% if 'mode' in backend %}
+ mode {{ backend.mode }}
+{% endif %}
+{% if 'options' in backend %}
+{% for option in backend.options %}
+ option {{ option }}
+{% endfor %}
+{% endif %}
{% for server in backend.servers %}
server {{ server.name }} {{ server.address }} {{ server.opts }}
{% endfor %}