From 00de5ec58dec3bf2a3211520b753a0a0363b43fc Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 30 Jul 2026 23:49:15 +0200 Subject: [PATCH 1/2] Consistency changes --- README.md | 30 +++++++++---------- molecule/default/converge.yml | 4 +-- templates/etc/haproxy/acl.j2 | 2 +- templates/etc/haproxy/haproxy.cfg.j2 | 2 +- .../bin/haproxy-letsencrypt-ocsp-deploy.j2 | 4 +-- .../bin/haproxy-letsencrypt-ssl-deploy.j2 | 2 +- tests/test.yml | 4 +-- tests/vagrant.yml | 4 +-- vars/main.yml | 6 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 7186cf00..e508bddb 100644 --- a/README.md +++ b/README.md @@ -547,7 +547,7 @@ None - name: http description: Front-end for all HTTP traffic bind: - - listen: "{{ ansible_eth0['ipv4']['address'] }}:80" + - listen: "{{ ansible_facts['eth0'] ['ipv4']['address'] }}:80" mode: http redirect: - string: 'scheme https code 301' @@ -556,7 +556,7 @@ None - name: https description: Front-end for all HTTPS traffic bind: - - listen: "{{ ansible_eth0['ipv4']['address'] }}:443" + - listen: "{{ ansible_facts['eth0'] ['ipv4']['address'] }}:443" param: - ssl - 'crt star-example1-com.pem' @@ -582,17 +582,17 @@ None cond: 'if { ssl_fc }' server: - name: web-01 - listen: "{{ ansible_lo['ipv4']['address'] }}:8001" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8001" param: - 'maxconn 501' - check - name: web-02 - listen: "{{ ansible_lo['ipv4']['address'] }}:8002" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8002" param: - 'maxconn 502' - check - name: web-03 - listen: "{{ ansible_lo['ipv4']['address'] }}:8003" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8003" param: - 'maxconn 503' - check @@ -611,12 +611,12 @@ None - fall 2 server: - name: mqtt-1 - listen: "{{ ansible_lo['ipv4']['address'] }}:1883" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:1883" param: - check - name: mqtt-2 - listen: "{{ ansible_lo['ipv4']['address'] }}:1883" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:1883" param: - check - backup @@ -665,7 +665,7 @@ None - name: stats description: Global statistics bind: - - listen: "{{ ansible_eth0['ipv4']['address'] }}:1936" + - listen: "{{ ansible_facts['eth0'] ['ipv4']['address'] }}:1936" param: - ssl - 'crt star-example0-com.pem' @@ -686,7 +686,7 @@ None - name: ssl-proxy description: Proxy for all HTTPS traffic bind: - - listen: "{{ ansible_eth0['ipv4']['address'] }}:443" + - listen: "{{ ansible_facts['eth0'] ['ipv4']['address'] }}:443" param: - ssl - 'crt star-example1-com.pem' @@ -700,7 +700,7 @@ None mode: http server: - name: "{{ inventory_hostname }}" - listen: "{{ ansible_lo['ipv4']['address'] }}:80" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:80" param: - send-proxy rspadd: @@ -713,8 +713,8 @@ None - name: http description: Front-end for all HTTP traffic bind: - - listen: "{{ ansible_eth0['ipv4']['address'] }}:80" - - listen: "{{ ansible_lo['ipv4']['address'] }}:80" + - listen: "{{ ansible_facts['eth0'] ['ipv4']['address'] }}:80" + - listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:80" param: - accept-proxy bind_process: @@ -740,17 +740,17 @@ None cond: 'if { dst_port 443 }' server: - name: web-01 - listen: "{{ ansible_lo['ipv4']['address'] }}:8001" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8001" param: - 'maxconn 501' - check - name: web-02 - listen: "{{ ansible_lo['ipv4']['address'] }}:8002" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8002" param: - 'maxconn 502' - check - name: web-03 - listen: "{{ ansible_lo['ipv4']['address'] }}:8003" + listen: "{{ ansible_facts['lo']['ipv4']['address'] }}:8003" param: - 'maxconn 503' - check diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 48ae76b6..ba368b5e 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -6,8 +6,8 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution_release }}.yml" - - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution | lower }}.yml" + - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/../../tests/vars/_default.yml" - name: include variables ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" diff --git a/templates/etc/haproxy/acl.j2 b/templates/etc/haproxy/acl.j2 index 0b8c0e02..ebc80add 100644 --- a/templates/etc/haproxy/acl.j2 +++ b/templates/etc/haproxy/acl.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} {% for content in item.content | default([]) %} {{ content }} diff --git a/templates/etc/haproxy/haproxy.cfg.j2 b/templates/etc/haproxy/haproxy.cfg.j2 index d3e1d0c1..1e6ba1ca 100644 --- a/templates/etc/haproxy/haproxy.cfg.j2 +++ b/templates/etc/haproxy/haproxy.cfg.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} global {% include 'global.cfg.j2' %} diff --git a/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 b/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 index 11ba29a5..ff33a017 100644 --- a/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 +++ b/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# {{ ansible_managed }} +{{ ansible_managed | comment }} # # set -x; set -e; @@ -37,7 +37,7 @@ done find "{{ haproxy_global_crt_base }}" -mindepth 1 -name "*.ocsp" -mtime +0 -delete; -{% if ansible_service_mgr == 'systemd' %} +{% if ansible_facts['service_mgr'] == 'systemd' %} systemctl reload haproxy; {% else %} service haproxy reload; diff --git a/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 b/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 index 0b43b40c..3c334494 100644 --- a/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 +++ b/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# {{ ansible_managed }} +{{ ansible_managed | comment }} # # set -x; set -e; diff --git a/tests/test.yml b/tests/test.yml index 87990b5e..f48cb3d5 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -8,8 +8,8 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml" - - "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/vars/_default.yml" - name: include variables ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 56621f76..105d5e9e 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -8,8 +8,8 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml" - - "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/vars/_default.yml" - name: include variables ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" diff --git a/vars/main.yml b/vars/main.yml index 6561cba2..26756f78 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -24,12 +24,12 @@ haproxy_keyring_id: 3D653970FBAB0A890E4E4E9A0F14D8B0CF4EFE96 haproxy_keyring_dst: /usr/share/keyrings/haproxy.gpg haproxy_repositories: - type: "deb [signed-by={{ haproxy_keyring_dst }}]" - url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}" + url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['ansible_distribution_release'] }}" component: main _haproxy_version_sources_list_d: "{{ (haproxy_version | string).split('.') | join('_') }}" haproxy_repository_files_absent: - - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_distribution_release }}.list" - - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_distribution_release }}.list.save" + - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['ansible_distribution_release'] }}.list" + - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['ansible_distribution_release'] }}.list.save" haproxy_dependencies_pre: - software-properties-common From 90207407b59c468f4ee40807274f407844a8c62e Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 30 Jul 2026 23:51:26 +0200 Subject: [PATCH 2/2] Fixes --- molecule/default/converge.yml | 2 +- tests/test.yml | 2 +- tests/vagrant.yml | 2 +- vars/main.yml | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index ba368b5e..19fa1bba 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -6,7 +6,7 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_facts['distribution_release'] }}.yml" - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/../../tests/vars/_default.yml" - name: include variables diff --git a/tests/test.yml b/tests/test.yml index f48cb3d5..c463fba4 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -8,7 +8,7 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution_release'] }}.yml" - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/vars/_default.yml" - name: include variables diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 105d5e9e..c75f7c0f 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -8,7 +8,7 @@ - name: include (first found) variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - "{{ playbook_dir }}/vars/_{{ ansible_facts['ansible_distribution_release'] }}.yml" + - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution_release'] }}.yml" - "{{ playbook_dir }}/vars/_{{ ansible_facts['distribution'] | lower }}.yml" - "{{ playbook_dir }}/vars/_default.yml" - name: include variables diff --git a/vars/main.yml b/vars/main.yml index 26756f78..5d8413ca 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -24,12 +24,12 @@ haproxy_keyring_id: 3D653970FBAB0A890E4E4E9A0F14D8B0CF4EFE96 haproxy_keyring_dst: /usr/share/keyrings/haproxy.gpg haproxy_repositories: - type: "deb [signed-by={{ haproxy_keyring_dst }}]" - url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['ansible_distribution_release'] }}" + url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }}" component: main _haproxy_version_sources_list_d: "{{ (haproxy_version | string).split('.') | join('_') }}" haproxy_repository_files_absent: - - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['ansible_distribution_release'] }}.list" - - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['ansible_distribution_release'] }}.list.save" + - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['distribution_release'] }}.list" + - "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['distribution_release'] }}.list.save" haproxy_dependencies_pre: - software-properties-common