From d138ff74e8288c1c92c0c4994f4e120de6b0a56d Mon Sep 17 00:00:00 2001 From: Jonathan Heathcote Date: Fri, 7 Feb 2025 12:17:33 +0000 Subject: [PATCH] Fix non-lazy ternery expression The ansible 'ternery' filter is not a real (lazy) ternery operator meaning that both branches are evaluated regardless of the input. Prior to this patch, this would erroneously result in a crash if 'interface' was not specified. Also includes unrelated linter-requested whitespace changes. Change-Id: I483550527b37276a7742ca116b7366bbd0b05875 --- tasks/haproxy_ssl_letsencrypt.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/haproxy_ssl_letsencrypt.yml b/tasks/haproxy_ssl_letsencrypt.yml index b010a32..f852be9 100644 --- a/tasks/haproxy_ssl_letsencrypt.yml +++ b/tasks/haproxy_ssl_letsencrypt.yml @@ -64,13 +64,13 @@ dest: >- {{ haproxy_ssl_cert_path ~ '/haproxy_' ~ ansible_facts['hostname'] ~ '-' ~ (item.get('interface')) | ternary( - item.get('address') ~ '-' ~ item['interface'], item['address']) ~ '.pem' + item.get('address') ~ '-' ~ item.get('interface'), item['address']) ~ '.pem' }} regexp: '(privkey|fullchain).pem$' owner: haproxy group: haproxy mode: "0640" with_items: - - "{{ haproxy_vip_binds | selectattr('type', 'defined') | selectattr('type', 'eq', 'external') }}" + - "{{ haproxy_vip_binds | selectattr('type', 'defined') | selectattr('type', 'eq', 'external') }}" notify: - Reload haproxy