diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index 3d8aa6b7..a85b9f1f 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -88,10 +88,8 @@ backend {{ backend.name }} {% endfor %} -{% if backend.errorfile is defined %} -{% for errorfile in backend.errorfile %} +{% for errorfile in backend.errorfile | default([]) %} errorfile {{ errorfile.code }} {{ errorfile.file }} {% endfor %} -{% endif %} {% endfor %} diff --git a/templates/etc/haproxy/frontend.cfg.j2 b/templates/etc/haproxy/frontend.cfg.j2 index 7b9197af..03317e3f 100644 --- a/templates/etc/haproxy/frontend.cfg.j2 +++ b/templates/etc/haproxy/frontend.cfg.j2 @@ -88,10 +88,8 @@ frontend {{ frontend.name }} default_backend {{ frontend.default_backend }} -{% if frontend.errorfile is defined %} -{% for errorfile in frontend.errorfile %} +{% for errorfile in frontend.errorfile | default([]) %} errorfile {{ errorfile.code }} {{ errorfile.file }} {% endfor %} -{% endif %} {% endfor %} diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index ea638f8c..efe61cbe 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -118,10 +118,8 @@ listen {{ listen.name }} {% endfor %} -{% if listen.errorfile is defined %} -{% for errorfile in listen.errorfile %} +{% for errorfile in listen.errorfile | default([]) %} errorfile {{ errorfile.code }} {{ errorfile.file }} {% endfor %} -{% endif %} {% endfor %}