From 691ca5690483d5feb165081b02e051a675e2e230 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 19 May 2026 09:19:08 +0200 Subject: [PATCH] chore: migrate bare ansible_* facts to ansible_facts[] syntax --- tasks/main.yaml | 6 +++--- tasks/prerequisites.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/main.yaml b/tasks/main.yaml index 5db382b..7eaa067 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -2,12 +2,12 @@ # load variables and collect version information - name: "include vars and collect versions" - when: "ansible_os_family not in 'Alpine'" + when: "ansible_facts['os_family'] not in 'Alpine'" block: # load os specific variables - name: "include os specific vars" - ansible.builtin.include_vars: "{{ ansible_os_family }}.yaml" + ansible.builtin.include_vars: "{{ ansible_facts['os_family'] }}.yaml" # collect zabbix-agent2 version information - name: "collect version information" @@ -22,4 +22,4 @@ # zabbix-agent prerequisites - name: "zabbix-agent prerequisites" ansible.builtin.import_tasks: "prerequisites.yaml" - when: "ansible_os_family not in 'Alpine'" + when: "ansible_facts['os_family'] not in 'Alpine'" diff --git a/tasks/prerequisites.yaml b/tasks/prerequisites.yaml index 00f4cfa..dda7d8d 100644 --- a/tasks/prerequisites.yaml +++ b/tasks/prerequisites.yaml @@ -7,7 +7,7 @@ # install repository - debian - name: "install repository" - when: 'ansible_os_family == "Debian"' + when: 'ansible_facts["os_family"] == "Debian"' block: - name: "remove old zabbix-release" @@ -18,7 +18,7 @@ - name: "install zabbix-release" ansible.builtin.apt: - deb: "{{ zabbix_repo_url[ansible_distribution][ansible_distribution_major_version | int] }}" + deb: "{{ zabbix_repo_url[ansible_facts['distribution']][ansible_facts['distribution_major_version'] | int] }}" state: "present" force: true @@ -29,7 +29,7 @@ # install repository - suse - name: "install repository" - when: 'ansible_os_family == "Suse"' + when: 'ansible_facts["os_family"] == "Suse"' block: - name: "remove old zabbix-release" @@ -39,7 +39,7 @@ - name: "install zabbix-release" ansible.builtin.zypper: - name: "{{ zabbix_repo_url[ansible_distribution_major_version | int] }}" + name: "{{ zabbix_repo_url[ansible_facts['distribution_major_version'] | int] }}" state: "present" disable_recommends: false nosignature: true