From ca0d3311817b3aab5aedfc08a71ad636b0508bdf Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 19 May 2026 09:19:07 +0200 Subject: [PATCH] chore: migrate bare ansible_* facts to ansible_facts[] syntax --- alpine-upgrade.yaml | 4 ++-- tasks/alpine323.yaml | 6 +++--- tasks/update.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/alpine-upgrade.yaml b/alpine-upgrade.yaml index 5a362ce..a7b48e4 100644 --- a/alpine-upgrade.yaml +++ b/alpine-upgrade.yaml @@ -11,5 +11,5 @@ - name: "import alpine upgrade tasks" ansible.builtin.import_tasks: "tasks/alpine323.yaml" when: - - "ansible_distribution == 'Alpine'" - - "'3.22' in ansible_distribution_version" + - "ansible_facts['distribution'] == 'Alpine'" + - "'3.22' in ansible_facts['distribution_version']" diff --git a/tasks/alpine323.yaml b/tasks/alpine323.yaml index 27590e9..5d0f27a 100644 --- a/tasks/alpine323.yaml +++ b/tasks/alpine323.yaml @@ -3,8 +3,8 @@ # these set of tasks will upgrade Alpine from v3.22 to v3.23 - name: "upgrade to alpine v3.23" when: - - "ansible_distribution == 'Alpine'" - - "'3.22' in ansible_distribution_version" + - "ansible_facts['distribution'] == 'Alpine'" + - "'3.22' in ansible_facts['distribution_version']" block: # change repositories @@ -52,7 +52,7 @@ ansible.builtin.command: cmd: "fstrim /" changed_when: false - when: "ansible_virtualization_type == 'kvm'" + when: "ansible_facts['virtualization_type'] == 'kvm'" # all is done - name: "all is done" diff --git a/tasks/update.yaml b/tasks/update.yaml index 3d87cbe..83a1569 100644 --- a/tasks/update.yaml +++ b/tasks/update.yaml @@ -9,7 +9,7 @@ # install updates - alpine - name: "install updates - alpine" - when: 'ansible_os_family == "Alpine"' + when: 'ansible_facts["os_family"] == "Alpine"' block: # install updates @@ -27,7 +27,7 @@ # install updates - debian - name: "install updates - debian" - when: 'ansible_os_family == "Debian"' + when: 'ansible_facts["os_family"] == "Debian"' block: # install updates @@ -46,7 +46,7 @@ # install updates - rhel - name: "install updates - rhel" - when: 'ansible_os_family == "RedHat"' + when: 'ansible_facts["os_family"] == "RedHat"' block: # install updates @@ -70,7 +70,7 @@ # install updates - suse - name: "install updates" - when: 'ansible_os_family == "Suse"' + when: 'ansible_facts["os_family"] == "Suse"' block: # install updates