From 916f8fa2f2b1f14d8ddf08896f755d464d9fa6ce Mon Sep 17 00:00:00 2001 From: dricoco <6524436+dricoco@users.noreply.github.com> Date: Tue, 24 Jan 2023 13:15:04 +0100 Subject: [PATCH] add test on value.servers if you use stick table, there is no server in backend, so we must test it or we get a no value defined with ansible --- templates/etc/haproxy/haproxy-backend.cfg.j2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/etc/haproxy/haproxy-backend.cfg.j2 b/templates/etc/haproxy/haproxy-backend.cfg.j2 index cb700f7..d0c5fa2 100644 --- a/templates/etc/haproxy/haproxy-backend.cfg.j2 +++ b/templates/etc/haproxy/haproxy-backend.cfg.j2 @@ -115,9 +115,11 @@ backend {{ name }} server-template {{ srv_tmpl }} {% endfor %} {% endif %} - {% for srv in value.servers %} + {% if value.servers is defined %} + {% for srv in value.servers %} server {{ srv }} - {% endfor %} + {% endfor %} + {% endif %} {% endfor %} {% endfor %}