[PR #11479/476f2bf6 backport][stable-12] Integration tests: replace ansible_xxx with ansible_facts.xxx (#11480)

Integration tests: replace ansible_xxx with ansible_facts.xxx (#11479)

Replace ansible_xxx with ansible_facts.xxx.

(cherry picked from commit 476f2bf641)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2026-02-07 18:43:49 +01:00
committed by GitHub
parent de6967d3ff
commit 7fce59fbc6
144 changed files with 548 additions and 578 deletions

View File

@@ -62,7 +62,7 @@
- block:
- include_tasks: remove_links.yml
- include_tasks: tests_family.yml
when: ansible_os_family == 'RedHat'
when: ansible_facts.os_family == 'RedHat'
# Cleanup
always:
@@ -94,6 +94,6 @@
# *Disable tests on Alpine*
# TODO: figure out whether there is an alternatives tool for Alpine
when:
- ansible_distribution != 'Fedora' or ansible_distribution_major_version|int > 24
- ansible_distribution != 'Archlinux'
- ansible_distribution != 'Alpine'
- ansible_facts.distribution != 'Fedora' or ansible_facts.distribution_major_version|int > 24
- ansible_facts.distribution != 'Archlinux'
- ansible_facts.distribution != 'Alpine'

View File

@@ -6,8 +6,8 @@
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_version }}.yml'
- '{{ ansible_facts.os_family }}.yml'
- default.yml
paths: ../vars
- template:

View File

@@ -9,8 +9,8 @@
owner: root
group: root
mode: '0644'
when: with_alternatives or ansible_os_family != 'RedHat'
when: with_alternatives or ansible_facts.os_family != 'RedHat'
- file:
path: '{{ alternatives_dir }}/dummy'
state: absent
when: not with_alternatives and ansible_os_family == 'RedHat'
when: not with_alternatives and ansible_facts.os_family == 'RedHat'

View File

@@ -46,11 +46,11 @@
- name: 'check mode (manual: alternatives file existed, it has been updated)'
shell: 'head -n1 {{ alternatives_dir }}/dummy | grep "^manual$"'
when: ansible_os_family != 'RedHat' or with_alternatives or item != 1
when: ansible_facts.os_family != 'RedHat' or with_alternatives or item != 1
- name: 'check mode (auto: alternatives file didn''t exist, it has been created)'
shell: 'head -n1 {{ alternatives_dir }}/dummy | grep "^auto$"'
when: ansible_os_family == 'RedHat' and not with_alternatives and item == 1
when: ansible_facts.os_family == 'RedHat' and not with_alternatives and item == 1
- name: check that alternative has been updated
command: "grep -Pzq '/bin/dummy{{ item }}\\n' '{{ alternatives_dir }}/dummy'"

View File

@@ -17,4 +17,4 @@
mode: '{{ test_conf[2] }}'
# update-alternatives included in Fedora 26 (1.10) & Red Hat 7.4 (1.8) doesn't provide
# '--query' switch, 'link' is mandatory for these distributions.
when: ansible_os_family != 'RedHat' or test_conf[0]
when: ansible_facts.os_family != 'RedHat' or test_conf[0]