From 2c33b70ba5e5cfc62887fd88eb70db39a7e374e2 Mon Sep 17 00:00:00 2001 From: Norman Ziegner Date: Wed, 20 Aug 2025 10:50:07 +0200 Subject: [PATCH 1/3] ci: disable injecting facts as own vars in the main namespace Signed-off-by: Norman Ziegner --- molecule/default/molecule.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 3c2f1e5..023e53c 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -17,5 +17,8 @@ platforms: pre_build_image: true provisioner: name: ansible + config_options: + defaults: + inject_facts_as_vars: false playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml} From c106b00876db2785d717123b36a66d02a40fc756 Mon Sep 17 00:00:00 2001 From: Norman Ziegner Date: Wed, 20 Aug 2025 10:56:19 +0200 Subject: [PATCH 2/3] Consistently access facts via the ansible_facts.* namespace Signed-off-by: Norman Ziegner --- defaults/main.yml | 2 +- molecule/default/converge.yml | 6 +++--- tasks/main.yml | 6 +++--- tasks/variables.yml | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 718b363..5b47284 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,7 +11,7 @@ postgresql_user: postgres postgresql_group: postgres # `md5` or `scram-sha-256` (https://www.postgresql.org/docs/10/auth-methods.html) -postgresql_auth_method: "{{ ansible_fips | ternary('scram-sha-256', 'md5') }}" +postgresql_auth_method: "{{ ansible_facts.fips | ternary('scram-sha-256', 'md5') }}" postgresql_unix_socket_directories: - /var/run/postgresql diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index d4b1853..662f0d9 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -28,13 +28,13 @@ lc_collate: 'C.UTF-8' lc_ctype: 'C.UTF-8' when: - - ( ansible_distribution == 'Fedora' and ansible_distribution_major_version >= '30') or - ( ansible_os_family == 'RedHat' and ansible_distribution_major_version in ['8','9']) + - ( ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version >= '30') or + ( ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version in ['8','9']) - name: Update apt cache. apt: update_cache=true cache_valid_time=600 changed_when: false - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' roles: - role: geerlingguy.postgresql diff --git a/tasks/main.yml b/tasks/main.yml index ef53122..a0da113 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,13 +4,13 @@ # Setup/install tasks. - include_tasks: setup-Archlinux.yml - when: ansible_os_family == 'Archlinux' + when: ansible_facts.os_family == 'Archlinux' - include_tasks: setup-Debian.yml - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - include_tasks: setup-RedHat.yml - when: ansible_os_family == 'RedHat' + when: ansible_facts.os_family == 'RedHat' - include_tasks: initialize.yml - include_tasks: configure.yml diff --git a/tasks/variables.yml b/tasks/variables.yml index 7e3a7a5..14b6468 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -1,23 +1,23 @@ --- # Variable configuration. - name: Include OS-specific variables (Debian). - include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml" - when: ansible_os_family == 'Debian' + include_vars: "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version.split('.')[0] }}.yml" + when: ansible_facts.os_family == 'Debian' - name: Include OS-specific variables (RedHat). - include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_version.split('.')[0] }}.yml" + include_vars: "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_version.split('.')[0] }}.yml" when: - - ansible_os_family == 'RedHat' - - ansible_distribution != 'Fedora' - - ansible_distribution != 'Amazon' + - ansible_facts.os_family == 'RedHat' + - ansible_facts.distribution != 'Fedora' + - ansible_facts.distribution != 'Amazon' - name: Include OS-specific variables (Amazon). - include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" - when: ansible_distribution == 'Amazon' + include_vars: "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml" + when: ansible_facts.distribution == 'Amazon' - name: Include OS-specific variables (Fedora). - include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml" - when: ansible_distribution == 'Fedora' + include_vars: "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version.split('.')[0] }}.yml" + when: ansible_facts.distribution == 'Fedora' - name: Define postgresql_packages. set_fact: From db95589c6a450105cbb68a00f7f359e24c5c517d Mon Sep 17 00:00:00 2001 From: Norman Ziegner Date: Mon, 25 Aug 2025 10:27:12 +0200 Subject: [PATCH 3/3] Revert "ci: disable injecting facts as own vars in the main namespace" This reverts commit 2c33b70ba5e5cfc62887fd88eb70db39a7e374e2. --- molecule/default/molecule.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 023e53c..3c2f1e5 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -17,8 +17,5 @@ platforms: pre_build_image: true provisioner: name: ansible - config_options: - defaults: - inject_facts_as_vars: false playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml}