diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index 855b2f09..137dd218 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -23,9 +23,17 @@ backend {{ backend.name }} {% if backend.cookie is defined %} cookie {{ backend.cookie }} {% endif %} +{% if backend.acl is defined %} +{% if backend.acl is mapping %} +{% for name, value in backend.acl.items() %} + acl {{ name }} {{ value }} +{% endfor %} +{% else %} {% for acl in backend.acl | default([]) %} - acl {{ acl.string }} + acl {{ acl.string | default(acl) }} {% endfor %} +{% endif %} +{% endif %} {% for stick in backend.stick | default([]) %} stick-table {{ stick.table }} stick on {{ stick.stick_on }} diff --git a/templates/etc/haproxy/frontend.cfg.j2 b/templates/etc/haproxy/frontend.cfg.j2 index 465c89f7..2313b6db 100644 --- a/templates/etc/haproxy/frontend.cfg.j2 +++ b/templates/etc/haproxy/frontend.cfg.j2 @@ -32,9 +32,17 @@ frontend {{ frontend.name }} {% for timeout in frontend.timeout | default([]) %} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} +{% if frontend.acl is defined %} +{% if frontend.acl is mapping %} +{% for name, value in frontend.acl.items() %} + acl {{ name }} {{ value }} +{% endfor %} +{% else %} {% for acl in frontend.acl | default([]) %} - acl {{ acl.string }} + acl {{ acl.string | default(acl) }} {% endfor %} +{% endif %} +{% endif %} {% for capture in frontend.capture | default([]) %} capture {{ capture.type }} {{ capture.name }} len {{ capture.length }} {% endfor %} diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index b46bfe92..dcd9dff2 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -42,9 +42,17 @@ listen {{ listen.name }} {% for timeout in listen.timeout | default([]) %} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} +{% if listen.acl is defined %} +{% if listen.acl is mapping %} +{% for name, value in listen.acl.items() %} + acl {{ name }} {{ value }} +{% endfor %} +{% else %} {% for acl in listen.acl | default([]) %} - acl {{ acl.string }} + acl {{ acl.string | default(acl) }} {% endfor %} +{% endif %} +{% endif %} {% for capture in listen.capture | default([]) %} capture {{ capture.type }} {{ capture.name }} len {{ capture.length }} {% endfor %}