From 2cc2fceaf6369ccbdda048d8e26a276e90f818a1 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 27 Nov 2023 18:20:50 +0100 Subject: [PATCH] Fix haproxy_stats SSL path defenition Neither `vip_interface` nor `vip_address` are defined or available in the context they're being used. Thus we need to refer to available variables in order to render base config properly Current version fail with "AnsibleUndefinedVariable: 'vip_interface' is undefined" on "Drop base haproxy config" task. This fix the issue that was introduced with [1] and backported back to Zed [1] https://review.opendev.org/q/Ib8be6b7fc3dada9d20905b0f07d90ddce0335605 Change-Id: I4e52378d8c5b3eaa6863ecaf0d04554d082e3dc0 --- templates/haproxy.cfg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index 189ba11..9b72454 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -40,7 +40,7 @@ defaults timeout server {{ haproxy_server_timeout }} maxconn {{ haproxy_maxconn }} {% if haproxy_stats_enabled | bool %} -{% set haproxy_ssl_path=haproxy_ssl_cert_path + "/haproxy_" + (haproxy_host | default(ansible_facts['hostname'])) + "-" + ((vip_interface is truthy) | ternary(vip_address ~ '-' ~ vip_interface, vip_address)) + ".pem" %} +{% set haproxy_ssl_path = haproxy_ssl_cert_path + "/haproxy_" + (haproxy_host | default(ansible_facts['hostname'])) + "-" + ((haproxy_bind_internal_lb_vip_interface is truthy) | ternary(haproxy_bind_internal_lb_vip_address ~ '-' ~ haproxy_bind_internal_lb_vip_interface, haproxy_bind_internal_lb_vip_address)) + ".pem" %} listen stats bind {{ haproxy_stats_bind_address }}:{{ haproxy_stats_port }} {% if haproxy_stats_ssl | bool %}ssl crt {{ haproxy_stats_ssl_cert_path | default(haproxy_ssl_path) }} {% if haproxy_stats_ssl_client_cert_ca is defined %}verify required ca-file {{ haproxy_stats_ssl_client_cert_ca }}{% endif %}{% endif %}