mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
Integration tests: replace ansible_xxx with ansible_facts.xxx (#11479)
Replace ansible_xxx with ansible_facts.xxx.
This commit is contained in:
parent
106817316d
commit
476f2bf641
144 changed files with 548 additions and 578 deletions
|
|
@ -29,7 +29,7 @@
|
|||
- '"Shut down initiated by Ansible" in shutdown_result_minus["shutdown_command"]'
|
||||
- '"Custom Message" not in shutdown_result_minus["shutdown_command"]'
|
||||
when:
|
||||
- 'ansible_os_family not in ["Alpine", "AIX"]'
|
||||
- 'ansible_facts.os_family not in ["Alpine", "AIX"]'
|
||||
- '"systemctl" not in shutdown_result["shutdown_command"]'
|
||||
- '"systemctl" not in shutdown_result_minus["shutdown_command"]'
|
||||
|
||||
|
|
@ -37,15 +37,15 @@
|
|||
assert:
|
||||
that: '"shutdown" in shutdown_result["shutdown_command"]'
|
||||
when:
|
||||
- "ansible_os_family != 'Alpine'"
|
||||
- "ansible_system != 'VMKernel'"
|
||||
- "ansible_facts.os_family != 'Alpine'"
|
||||
- "ansible_facts.system != 'VMKernel'"
|
||||
- '"systemctl" not in shutdown_result["shutdown_command"]'
|
||||
|
||||
- name: Verify shutdown command is present in Alpine except systemd
|
||||
assert:
|
||||
that: '"poweroff" in shutdown_result["shutdown_command"]'
|
||||
when:
|
||||
- "ansible_os_family == 'Alpine'"
|
||||
- "ansible_facts.os_family == 'Alpine'"
|
||||
- '"systemctl" not in shutdown_result["shutdown_command"]'
|
||||
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
assert:
|
||||
that: '"halt" in shutdown_result["shutdown_command"]'
|
||||
when:
|
||||
- "ansible_system == 'VMKernel'"
|
||||
- "ansible_facts.system == 'VMKernel'"
|
||||
- '"systemctl" not in shutdown_result["shutdown_command"]'
|
||||
|
||||
- name: Verify shutdown delay is present in minutes in Linux except systemd
|
||||
|
|
@ -62,8 +62,8 @@
|
|||
- '"-h 1" in shutdown_result["shutdown_command"]'
|
||||
- '"-h 0" in shutdown_result_minus["shutdown_command"]'
|
||||
when:
|
||||
- "ansible_system == 'Linux'"
|
||||
- "ansible_os_family != 'Alpine'"
|
||||
- "ansible_facts.system == 'Linux'"
|
||||
- "ansible_facts.os_family != 'Alpine'"
|
||||
- '"systemctl" not in shutdown_result["shutdown_command"]'
|
||||
- '"systemctl" not in shutdown_result_minus["shutdown_command"]'
|
||||
|
||||
|
|
@ -72,47 +72,47 @@
|
|||
that:
|
||||
- '"-h +1" in shutdown_result["shutdown_command"]'
|
||||
- '"-h +0" in shutdown_result_minus["shutdown_command"]'
|
||||
when: ansible_system in ['Void', 'Darwin', 'OpenBSD']
|
||||
when: ansible_facts.system in ['Void', 'Darwin', 'OpenBSD']
|
||||
|
||||
- name: Verify shutdown delay is present in seconds in FreeBSD
|
||||
assert:
|
||||
that:
|
||||
- '"-p +100s" in shutdown_result["shutdown_command"]'
|
||||
- '"-p +0s" in shutdown_result_minus["shutdown_command"]'
|
||||
when: ansible_system == 'FreeBSD'
|
||||
when: ansible_facts.system == 'FreeBSD'
|
||||
|
||||
- name: Verify shutdown delay is present in seconds in Solaris, SunOS
|
||||
assert:
|
||||
that:
|
||||
- '"-g 100" in shutdown_result["shutdown_command"]'
|
||||
- '"-g 0" in shutdown_result_minus["shutdown_command"]'
|
||||
when: ansible_system in ['Solaris', 'SunOS']
|
||||
when: ansible_facts.system in ['Solaris', 'SunOS']
|
||||
|
||||
- name: Verify shutdown delay is present in seconds, VMKernel
|
||||
assert:
|
||||
that:
|
||||
- '"-d 100" in shutdown_result["shutdown_command"]'
|
||||
- '"-d 0" in shutdown_result_minus["shutdown_command"]'
|
||||
when: ansible_system == 'VMKernel'
|
||||
when: ansible_facts.system == 'VMKernel'
|
||||
|
||||
- name: Ensure that systemd-sysv is absent in Ubuntu 18 and Debian
|
||||
apt:
|
||||
name: sytemd-sysv
|
||||
state: absent
|
||||
when: (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18', '>=')) or (ansible_distribution == 'Debian')
|
||||
when: (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version is version('18', '>=')) or (ansible_facts.distribution == 'Debian')
|
||||
register: systemd_sysv_install
|
||||
|
||||
- name: Gather package facts
|
||||
package_facts:
|
||||
manager: apt
|
||||
when: (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18', '>=')) or (ansible_distribution == 'Debian')
|
||||
when: (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version is version('18', '>=')) or (ansible_facts.distribution == 'Debian')
|
||||
|
||||
- name: Execute shutdown if no systemd-sysv
|
||||
community.general.shutdown:
|
||||
register: shutdown_result
|
||||
check_mode: true
|
||||
when:
|
||||
- "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18', '>=')) or (ansible_distribution == 'Debian')"
|
||||
- "(ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version is version('18', '>=')) or (ansible_facts.distribution == 'Debian')"
|
||||
- '"systemd-sysv" not in ansible_facts.packages'
|
||||
|
||||
- name: Install systemd_sysv in case it has been removed in test
|
||||
|
|
@ -120,5 +120,5 @@
|
|||
name: systemd-sysv
|
||||
state: present
|
||||
when:
|
||||
- "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18', '>=')) or (ansible_distribution == 'Debian')"
|
||||
- "(ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version is version('18', '>=')) or (ansible_facts.distribution == 'Debian')"
|
||||
- "systemd_sysv_install is changed"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue