1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

[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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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]

View file

@ -11,21 +11,21 @@
# java >= 17 is not available in RHEL and CentOS7 repos, which is required for sdkmanager to run
- name: Bail out if not supported
when:
- "ansible_os_family == 'RedHat' and ansible_distribution_version is version('8.0', '<')"
- "ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version is version('8.0', '<')"
ansible.builtin.meta: end_play
- name: Run android_sdk tests
environment:
PATH: '{{ ansible_env.PATH }}:{{ android_sdk_location }}/cmdline-tools/latest/bin'
PATH: '{{ ansible_facts.env.PATH }}:{{ android_sdk_location }}/cmdline-tools/latest/bin'
block:
- import_tasks: setup.yml
- name: Run default tests
import_tasks: default-tests.yml
when: ansible_os_family != 'FreeBSD'
when: ansible_facts.os_family != 'FreeBSD'
# Most of the important Android SDK packages are not available on FreeBSD (like, build-tools, platform-tools and so on),
# but at least some of the functionality can be tested (like, downloading sources)
- name: Run FreeBSD tests
import_tasks: freebsd-tests.yml
when: ansible_os_family == 'FreeBSD'
when: ansible_facts.os_family == 'FreeBSD'

View file

@ -13,10 +13,10 @@
vars:
params:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml'
- '{{ ansible_facts.distribution }}.yml'
- '{{ ansible_facts.os_family }}.yml'
paths:
- '{{ role_path }}/vars'
@ -27,7 +27,7 @@
- "{{ openjdk_pkg }}"
- unzip
state: present
when: ansible_os_family != 'Darwin'
when: ansible_facts.os_family != 'Darwin'
- name: Install dependencies (OSX)
block:
@ -56,7 +56,7 @@
dest: "/Library/Java/JavaVirtualMachines/openjdk-17.jdk"
state: link
when:
- ansible_os_family == 'Darwin'
- ansible_facts.os_family == 'Darwin'
- name: Create Android SDK directory
file:

View file

@ -9,7 +9,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- meta: end_play
when: ansible_os_family not in ['Debian', 'Suse']
when: ansible_facts.os_family not in ['Debian', 'Suse']
- name: Enable mod_proxy
community.general.apache2_module:
@ -24,12 +24,12 @@
- name: Add port 81
lineinfile:
path: "/etc/apache2/{{ 'ports.conf' if ansible_os_family == 'Debian' else 'listen.conf' }}"
path: "/etc/apache2/{{ 'ports.conf' if ansible_facts.os_family == 'Debian' else 'listen.conf' }}"
line: Listen 81
- name: Set up virtual host
copy:
dest: "/etc/apache2/{{ 'sites-available' if ansible_os_family == 'Debian' else 'vhosts.d' }}/000-apache2_mod_proxy-test.conf"
dest: "/etc/apache2/{{ 'sites-available' if ansible_facts.os_family == 'Debian' else 'vhosts.d' }}/000-apache2_mod_proxy-test.conf"
content: |
<VirtualHost *:81>
<Proxy balancer://mycluster>
@ -62,7 +62,7 @@
owner: root
group: root
state: link
when: ansible_os_family not in ['Suse']
when: ansible_facts.os_family not in ['Suse']
- name: Restart Apache
service:

View file

@ -65,7 +65,7 @@
state: present
- name: Debian/Ubuntu specific tests
when: "ansible_os_family == 'Debian'"
when: "ansible_facts.os_family == 'Debian'"
block:
- name: force disable of autoindex # bug #2499
community.general.apache2_module:
@ -89,7 +89,7 @@
name: evasive
state: present
# TODO: fix for Debian 13 (Trixie)!
when: ansible_distribution != 'Debian' or ansible_distribution_major_version is version('13', '<')
when: ansible_facts.distribution != 'Debian' or ansible_facts.distribution_major_version is version('13', '<')
- name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
community.general.apache2_module:

View file

@ -28,10 +28,10 @@
- name: ensure that all test modules are disabled again
assert:
that: modules_before.stdout == modules_after.stdout
when: ansible_os_family in ['Debian', 'Suse']
when: ansible_facts.os_family in ['Debian', 'Suse']
# centos/RHEL does not have a2enmod/a2dismod
- name: include misleading warning test
include_tasks: 635-apache2-misleading-warning.yml
when: ansible_os_family in ['Debian']
when: ansible_facts.os_family in ['Debian']
# Suse has mpm_event module compiled within the base apache2

View file

@ -7,7 +7,7 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Run apk tests on Alpine
when: ansible_distribution in ['Alpine']
when: ansible_facts.distribution in ['Alpine']
block:
- name: Ensure vim is not installed
community.general.apk:

View file

@ -12,7 +12,7 @@
cargo_environment:
# See https://github.com/rust-lang/cargo/issues/10230#issuecomment-1201662729:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
when: has_cargo | default(false) and ansible_distribution == 'Alpine'
when: has_cargo | default(false) and ansible_facts.distribution == 'Alpine'
- block:
- import_tasks: test_general.yml
- import_tasks: test_version.yml

View file

@ -11,11 +11,11 @@
- set_fact:
has_cargo: true
when:
- ansible_system != 'FreeBSD'
- ansible_distribution != 'MacOSX'
- ansible_distribution != 'RedHat' or ansible_distribution_version is version('8.0', '>=')
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=')
- ansible_facts.system != 'FreeBSD'
- ansible_facts.distribution != 'MacOSX'
- ansible_facts.distribution != 'RedHat' or ansible_facts.distribution_version is version('8.0', '>=')
- ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_version is version('7.0', '>=')
- ansible_facts.distribution != 'Ubuntu' or ansible_facts.distribution_version is version('18', '>=')
- block:
- name: Install rust (containing cargo)
@ -25,7 +25,7 @@
- set_fact:
has_cargo: true
when:
- ansible_system == 'FreeBSD' and ansible_distribution_version is version('13.0', '>')
- ansible_facts.system == 'FreeBSD' and ansible_facts.distribution_version is version('13.0', '>')
- block:
- name: Download rustup
@ -39,4 +39,4 @@
- set_fact:
rustup_cargo_bin: "{{ lookup('env', 'HOME') }}/.cargo/bin/cargo"
when:
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')
- ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_version is version('7.0', '>=')

View file

@ -11,10 +11,10 @@
- name: Help debugging
debug:
msg: >-
distribution={{ ansible_distribution }},
distribution major version={{ ansible_distribution_major_version }},
os_family={{ ansible_os_family }},
Python version={{ ansible_python.version.major }}
distribution={{ ansible_facts.distribution }},
distribution major version={{ ansible_facts.distribution_major_version }},
os_family={{ ansible_facts.os_family }},
Python version={{ ansible_facts.python.version.major }}
- name: test cloud-init
# TODO: check for a workaround
@ -23,13 +23,13 @@
# /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.distrib
# https://bugs.launchpad.net/ubuntu/+source/ureadahead/+bug/997838
when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int == 15)
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service
- not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?
- not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect
- not (ansible_distribution == 'Debian' and ansible_distribution_major_version|int == 13) # TODO: not sure what's wrong here, the module doesn't return what the tests expect
- not (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int == 43) # TODO: not sure what's wrong here, the module doesn't return what the tests expect
- not (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version|int == 14)
- not (ansible_facts.os_family == "Suse" and ansible_facts.distribution_major_version|int == 15)
- not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_major_version|int == 8) # TODO: cannot start service
- not (ansible_facts.distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?
- not (ansible_facts.distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect
- not (ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version|int == 13) # TODO: not sure what's wrong here, the module doesn't return what the tests expect
- not (ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version|int == 43) # TODO: not sure what's wrong here, the module doesn't return what the tests expect
block:
- name: setup install cloud-init
package:
@ -41,7 +41,7 @@
user:
name: systemd-network
state: present
when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 37
when: ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version|int >= 37
- name: setup run cloud-init
service:

View file

@ -171,8 +171,8 @@ cmd_echo_tests:
- name: use cmd {{ remote_tmp_dir }}/echo
condition: >
{{
ansible_distribution != "MacOSX" and
not (ansible_distribution == "CentOS" and ansible_distribution_major_version is version('7.0', '<'))
ansible_facts.distribution != "MacOSX" and
not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_major_version is version('7.0', '<'))
}}
copy_to: "{{ remote_tmp_dir }}"
cmd: "{{ remote_tmp_dir }}/echo"
@ -196,8 +196,8 @@ cmd_echo_tests:
cmd: echo
condition: >
{{
ansible_distribution != "MacOSX" and
not (ansible_distribution == "CentOS" and ansible_distribution_major_version is version('7.0', '<'))
ansible_facts.distribution != "MacOSX" and
not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_major_version is version('7.0', '<'))
}}
copy_to: "{{ remote_tmp_dir }}"
path_prefix: "{{ remote_tmp_dir }}"

View file

@ -11,7 +11,7 @@
- name: Install Consul and test
vars:
consul_version: 1.13.2
consul_uri: https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_{{ ansible_system | lower }}_{{ consul_arch }}.zip
consul_uri: https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_{{ ansible_facts.system | lower }}_{{ consul_arch }}.zip
consul_cmd: '{{ remote_tmp_dir }}/consul'
block:
- name: Install requests<2.20 (CentOS/RHEL 6)
@ -20,7 +20,7 @@
extra_args: "-c {{ remote_constraints }}"
register: result
until: result is success
when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=')
when: ansible_facts.distribution_file_variety|default() == 'RedHat' and ansible_facts.distribution_major_version is version('6', '<=')
- name: Install py-consul
pip:
name: py-consul
@ -51,15 +51,15 @@
name: unzip
register: result
until: result is success
when: ansible_distribution != "MacOSX"
when: ansible_facts.distribution != "MacOSX"
- assert:
that: ansible_architecture in ['i386', 'x86_64', 'amd64']
that: ansible_facts.architecture in ['i386', 'x86_64', 'amd64']
- set_fact:
consul_arch: '386'
when: ansible_architecture == 'i386'
when: ansible_facts.architecture == 'i386'
- set_fact:
consul_arch: amd64
when: ansible_architecture in ['x86_64', 'amd64']
when: ansible_facts.architecture in ['x86_64', 'amd64']
- name: Download consul binary
unarchive:
src: '{{ consul_uri }}'

View file

@ -7,9 +7,9 @@
# Fedora or RHEL >= 8
# This module requires the dnf module which is not available on RHEL 7.
- >
ansible_distribution == 'Fedora'
or (ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
and ansible_distribution_major_version | int >= 8)
ansible_facts.distribution == 'Fedora'
or (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution != 'Fedora'
and ansible_facts.distribution_major_version | int >= 8)
block:
- debug: var=copr_chroot
- name: enable copr project
@ -66,8 +66,8 @@
when:
# Copr does not build new packages for EOL Fedoras.
- >
not (ansible_distribution == 'Fedora' and
ansible_distribution_major_version | int < 35)
not (ansible_facts.distribution == 'Fedora' and
ansible_facts.distribution_major_version | int < 35)
block:
- name: install test package from the copr
ansible.builtin.package:

View file

@ -11,5 +11,5 @@ copr_repofile: '/etc/yum.repos.d/_copr:{{ copr_host }}:{{ copr_namespace }}:{{ c
# TODO: Fix chroot autodetection so this isn't necessary
_copr_chroot_fedora: "fedora-rawhide-x86_64"
_copr_chroot_rhelish: "epel-{{ ansible_distribution_major_version }}-x86_64"
copr_chroot: "{{ _copr_chroot_fedora if ansible_distribution == 'Fedora' else _copr_chroot_rhelish }}"
_copr_chroot_rhelish: "epel-{{ ansible_facts.distribution_major_version }}-x86_64"
copr_chroot: "{{ _copr_chroot_fedora if ansible_facts.distribution == 'Fedora' else _copr_chroot_rhelish }}"

View file

@ -6,9 +6,9 @@
- name: bail out for non-supported platforms
meta: end_play
when:
- (ansible_os_family != "RedHat" or ansible_distribution_major_version|int < 8) # TODO: bump back to 7
- (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int < 8) # TODO: remove
- ansible_os_family != "Debian"
- (ansible_facts.os_family != "RedHat" or ansible_facts.distribution_major_version|int < 8) # TODO: bump back to 7
- (ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version|int < 8) # TODO: remove
- ansible_facts.os_family != "Debian"
- name: install perl development package for Red Hat family
package:
@ -17,7 +17,7 @@
- perl-App-cpanminus
state: present
become: true
when: ansible_os_family == "RedHat"
when: ansible_facts.os_family == "RedHat"
- name: install perl development package for Debian family
package:
@ -25,7 +25,7 @@
- cpanminus
state: present
become: true
when: ansible_os_family == "Debian"
when: ansible_facts.os_family == "Debian"
- name: install a Perl package
cpanm:

View file

@ -27,15 +27,15 @@
- bzip2
state: latest
when:
- ansible_system != 'FreeBSD'
- ansible_os_family != 'Darwin'
- ansible_os_family != 'Debian'
- ansible_facts.system != 'FreeBSD'
- ansible_facts.os_family != 'Darwin'
- ansible_facts.os_family != 'Debian'
- name: Ensure xz is present to create compressed files (Debian)
package:
name: xz-utils
state: latest
when: ansible_os_family == 'Debian'
when: ansible_facts.os_family == 'Debian'
- name: Ensure xz is present to create compressed file (macOS)
block:
@ -58,7 +58,7 @@
environment:
HOMEBREW_NO_AUTO_UPDATE: "True"
when:
- ansible_os_family == 'Darwin'
- ansible_facts.os_family == 'Darwin'
- name: Generate compressed files
shell: |

View file

@ -42,7 +42,7 @@
value: 1
- name: "Field 2"
value: "Text"
timestamp: "{{ ansible_date_time.iso8601 }}"
timestamp: "{{ ansible_facts.date_time.iso8601 }}"
username: Ansible Test
avatar_url: "https://avatars.githubusercontent.com/u/44586252?s=200&v=4"
register: result

View file

@ -7,6 +7,6 @@
- include_tasks: install.yml
- include_tasks: lock_bash.yml
- include_tasks: lock_updates.yml
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
(ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>='))
when: (ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version is version('23', '>=')) or
(ansible_facts.distribution in ['RedHat', 'CentOS'] and ansible_facts.distribution_major_version is version('8', '>='))
...

View file

@ -10,4 +10,4 @@
- name: "include tasks for Debian family"
include_tasks: prepare.yml
when: ansible_pkg_mgr == "apt"
when: ansible_facts.pkg_mgr == "apt"

View file

@ -14,9 +14,9 @@
# TODO: remove Ubuntu 24.04 (noble) from the list
# TODO: remove Debian 13 (Trixie) from the list
when: >
ansible_distribution in ('Alpine', 'openSUSE Leap', 'CentOS', 'Fedora', 'Archlinux')
or (ansible_distribution == 'Ubuntu' and ansible_distribution_release in ['noble'])
or (ansible_distribution == 'Debian' and ansible_distribution_major_version == '13')
ansible_facts.distribution in ('Alpine', 'openSUSE Leap', 'CentOS', 'Fedora', 'Archlinux')
or (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_release in ['noble'])
or (ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version == '13')
- name: Remove ejabberd
ansible.builtin.package:
@ -47,12 +47,12 @@
loop:
- PrivateDevices
- AmbientCapabilities
when: ansible_distribution == 'Archlinux'
when: ansible_facts.distribution == 'Archlinux'
- name: Make installable on Arch
systemd:
daemon_reload: true
when: ansible_distribution == 'Archlinux'
when: ansible_facts.distribution == 'Archlinux'
- ansible.builtin.service:
name: ejabberd

View file

@ -15,4 +15,4 @@
- name: run_tests for supported distros
include_tasks: run_tests.yml
when:
- ansible_distribution | lower ~ "-" ~ ansible_distribution_major_version | lower != 'centos-6'
- ansible_facts.distribution | lower ~ "-" ~ ansible_facts.distribution_major_version | lower != 'centos-6'

View file

@ -32,7 +32,7 @@
- name: Include tasks to test playing with sparse files
include_tasks: sparse.yml
when:
- not (ansible_os_family == 'Darwin' and ansible_distribution_version is version('11', '<'))
- not (ansible_facts.os_family == 'Darwin' and ansible_facts.distribution_version is version('11', '<'))
- name: Include tasks to test playing with symlinks
include_tasks: symlinks.yml

View file

@ -55,7 +55,7 @@
- name: "Assert that filesystem UUID is changed"
# libblkid gets no UUID at all for this fstype on FreeBSD
when: not (ansible_system == 'FreeBSD' and fstype == 'reiserfs')
when: not (ansible_facts.system == 'FreeBSD' and fstype == 'reiserfs')
ansible.builtin.assert:
that:
- 'fs3_result is changed'
@ -102,8 +102,8 @@
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
(fstype == "xfs" and ansible_facts.system == "Linux" and
ansible_facts.distribution not in ["CentOS", "Ubuntu"])
block:
- name: "Check that resizefs does nothing if device size is not changed"
community.general.filesystem:

View file

@ -18,7 +18,7 @@
vars:
search:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
- 'default.yml'
paths:
- '../vars/'
@ -36,54 +36,54 @@
# Not available: btrfs, lvm, f2fs, ocfs2
# All BSD systems use swap fs, but only Linux needs mkswap
# Supported: ext2/3/4 (e2fsprogs), xfs (xfsprogs), reiserfs (progsreiserfs), vfat
- 'not (ansible_system == "FreeBSD" and item.0.key in ["bcachefs", "btrfs", "f2fs", "swap", "lvm", "ocfs2"])'
- 'not (ansible_facts.system == "FreeBSD" and item.0.key in ["bcachefs", "btrfs", "f2fs", "swap", "lvm", "ocfs2"])'
# Available on FreeBSD but not on testbed (util-linux conflicts with e2fsprogs): wipefs, mkfs.minix
- 'not (ansible_system == "FreeBSD" and item.1 in ["overwrite_another_fs", "remove_fs"])'
- 'not (ansible_facts.system == "FreeBSD" and item.1 in ["overwrite_another_fs", "remove_fs"])'
# Linux limited support
# Not available: ufs (this is FreeBSD's native fs)
- 'not (ansible_system == "Linux" and item.0.key == "ufs")'
- 'not (ansible_facts.system == "Linux" and item.0.key == "ufs")'
# Other limitations and corner cases
# bcachefs only on Alpine > 3.18 and Arch Linux for now
# other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
- 'ansible_distribution == "Alpine" and ansible_distribution_version is version("3.18", ">") and item.0.key == "bcachefs"'
- 'ansible_distribution == "Archlinux" and item.0.key == "bcachefs"'
- 'ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">") and item.0.key == "bcachefs"'
- 'ansible_facts.distribution == "Archlinux" and item.0.key == "bcachefs"'
# f2fs-tools and reiserfs-utils packages not available with RHEL/CentOS on CI
- 'not (ansible_distribution in ["CentOS", "RedHat"] and item.0.key in ["f2fs", "reiserfs"])'
- 'not (ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", ">=") and
- 'not (ansible_facts.distribution in ["CentOS", "RedHat"] and item.0.key in ["f2fs", "reiserfs"])'
- 'not (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version("8", ">=") and
item.0.key == "btrfs")'
# reiserfs-utils package not available with Fedora 35 on CI
- 'not (ansible_distribution == "Fedora" and (ansible_facts.distribution_major_version | int >= 35) and
- 'not (ansible_facts.distribution == "Fedora" and (ansible_facts.distribution_major_version | int >= 35) and
item.0.key == "reiserfs")'
# reiserfs packages apparently not available with Alpine
- 'not (ansible_distribution == "Alpine" and item.0.key == "reiserfs")'
- 'not (ansible_facts.distribution == "Alpine" and item.0.key == "reiserfs")'
# reiserfsprogs packages no longer available with Arch Linux
- 'not (ansible_distribution == "Archlinux" and item.0.key == "reiserfs")'
- 'not (ansible_facts.distribution == "Archlinux" and item.0.key == "reiserfs")'
# ocfs2 only available on Debian based distributions
- 'not (item.0.key == "ocfs2" and ansible_os_family != "Debian")'
- 'not (item.0.key == "ocfs2" and ansible_facts.os_family != "Debian")'
# Tests use losetup which can not be used inside unprivileged container
- 'not (item.0.key == "lvm" and ansible_virtualization_type in ["docker", "container", "containerd"])'
- 'not (item.0.key == "lvm" and ansible_facts.virtualization_type in ["docker", "container", "containerd"])'
# vfat resizing fails on Debian (but not Ubuntu)
- 'not (item.0.key == "vfat" and ansible_distribution == "Debian")' # TODO: figure out why it fails, fix it!
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Debian")' # TODO: figure out why it fails, fix it!
# vfat resizing fails on ArchLinux
- 'not (item.0.key == "vfat" and ansible_distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
# vfat resizing fails on Ubuntu 22.04
- 'not (item.0.key == "vfat" and ansible_distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int == 22))'
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int == 22))'
# TODO: figure out why it fails, fix it!
# btrfs-progs cannot be installed on ArchLinux
- 'not (item.0.key == "btrfs" and ansible_distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
- 'not (item.0.key == "btrfs" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
# On CentOS 6 shippable containers, wipefs seems unable to remove vfat signatures
- 'not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<") and
- 'not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_version is version("7.0", "<") and
item.1 == "remove_fs" and item.0.key == "vfat")'
# On same systems, mkfs.minix (unhandled by the module) can't find the device/file
- 'not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<") and
- 'not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_version is version("7.0", "<") and
item.1 == "overwrite_another_fs")'
# TODO: something seems to be broken on Alpine
- 'not (ansible_distribution == "Alpine")'
- 'not (ansible_facts.distribution == "Alpine")'
loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'reset_fs_uuid', 'overwrite_another_fs', 'remove_fs', 'set_fs_uuid_on_creation', 'set_fs_uuid_on_creation_with_opts'])|list }}"
@ -92,8 +92,8 @@
- include_tasks: freebsd_setup.yml
when:
- 'ansible_system == "FreeBSD"'
- 'ansible_distribution_version is version("12.2", ">=")'
- 'ansible_facts.system == "FreeBSD"'
- 'ansible_facts.distribution_version is version("12.2", ">=")'
- include_tasks: create_device.yml
vars:
@ -103,7 +103,7 @@
grow: '{{ item.0.value.grow }}'
action: '{{ item.1 }}'
when:
- 'ansible_system == "FreeBSD"'
- 'ansible_distribution_version is version("12.2", ">=")'
- 'ansible_facts.system == "FreeBSD"'
- 'ansible_facts.distribution_version is version("12.2", ">=")'
- 'item.0.key in ["xfs", "vfat"]'
loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'overwrite_another_fs', 'remove_fs'])|list }}"

View file

@ -6,7 +6,7 @@
# Skip UUID reset tests for FreeBSD due to "xfs_admin: only 'rewrite' supported on V5 fs"
- when:
- new_uuid | default(False)
- not (ansible_system == "FreeBSD" and fstype == "xfs")
- not (ansible_facts.system == "FreeBSD" and fstype == "xfs")
block:
- name: "Create filesystem ({{ fstype }})"
community.general.filesystem:
@ -42,8 +42,8 @@
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
(fstype == "xfs" and ansible_facts.system == "Linux" and
ansible_facts.distribution not in ["CentOS", "Ubuntu"])
block:
- name: "Reset filesystem ({{ fstype }}) UUID and resizefs"
ignore_errors: true

View file

@ -10,7 +10,7 @@
# Skip UUID set at creation tests for FreeBSD due to "xfs_admin: only 'rewrite' supported on V5 fs"
- when:
- new_uuid | default(False)
- not (ansible_system == "FreeBSD" and fstype == "xfs")
- not (ansible_facts.system == "FreeBSD" and fstype == "xfs")
block:
- name: "Create filesystem ({{ fstype }}) with UUID"
community.general.filesystem:

View file

@ -21,27 +21,27 @@
when:
# bcachefs only on Alpine > 3.18 and Arch Linux for now
# other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
- ansible_distribution == "Alpine" and ansible_distribution_version is version("3.18", ">")
- ansible_distribution == "Archlinux"
- ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">")
- ansible_facts.distribution == "Archlinux"
- name: "Install btrfs progs"
ansible.builtin.package:
name: btrfs-progs
state: present
when:
- ansible_os_family != 'Suse'
- not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('16.04', '<='))
- ansible_system != "FreeBSD"
- ansible_facts.os_family != 'Suse'
- not (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version is version('16.04', '<='))
- ansible_facts.system != "FreeBSD"
- not (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version('8', '>='))
- ansible_os_family != 'Archlinux' # TODO
- ansible_facts.os_family != 'Archlinux' # TODO
- name: "Install btrfs tools (Ubuntu <= 16.04)"
ansible.builtin.package:
name: btrfs-tools
state: present
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_version is version('16.04', '<=')
- ansible_facts.distribution == 'Ubuntu'
- ansible_facts.distribution_version is version('16.04', '<=')
- name: "Install btrfs progs (OpenSuse)"
ansible.builtin.package:
@ -49,14 +49,14 @@
- python3-xml
- btrfsprogs
state: present
when: ansible_os_family == 'Suse'
when: ansible_facts.os_family == 'Suse'
- name: "Install reiserfs utils (Fedora)"
ansible.builtin.package:
name: reiserfs-utils
state: present
when:
- ansible_distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
- ansible_facts.distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
- name: "Install reiserfs and util-linux-systemd (for findmnt) (OpenSuse)"
ansible.builtin.package:
@ -65,34 +65,34 @@
- util-linux-systemd
state: present
when:
- ansible_os_family == 'Suse'
- ansible_facts.os_family == 'Suse'
- name: "Install reiserfs progs (Debian and more)"
ansible.builtin.package:
name: reiserfsprogs
state: present
when:
- ansible_system == 'Linux'
- ansible_os_family not in ['Suse', 'RedHat', 'Alpine', 'Archlinux']
- ansible_facts.system == 'Linux'
- ansible_facts.os_family not in ['Suse', 'RedHat', 'Alpine', 'Archlinux']
- name: "Install reiserfs progs (FreeBSD)"
ansible.builtin.package:
name: progsreiserfs
state: present
when:
- ansible_system == 'FreeBSD'
- ansible_facts.system == 'FreeBSD'
- name: "Install ocfs2 (Debian)"
ansible.builtin.package:
name: ocfs2-tools
state: present
when: ansible_os_family == 'Debian'
when: ansible_facts.os_family == 'Debian'
- name: "Install f2fs tools and get version"
when:
- ansible_os_family != 'RedHat' or ansible_distribution == 'Fedora'
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('16.04', '>=')
- ansible_system != "FreeBSD"
- ansible_facts.os_family != 'RedHat' or ansible_facts.distribution == 'Fedora'
- ansible_facts.distribution != 'Ubuntu' or ansible_facts.distribution_version is version('16.04', '>=')
- ansible_facts.system != "FreeBSD"
block:
- name: "Install f2fs tools"
ansible.builtin.package:
@ -117,14 +117,14 @@
name:
- dosfstools
- lvm2
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
- name: "Install fatresize and get version"
when:
- ansible_system == 'Linux'
- ansible_os_family != 'Suse'
- ansible_os_family != 'RedHat' or (ansible_distribution == 'CentOS' and ansible_distribution_version is version('7.0', '=='))
- ansible_os_family != 'Alpine'
- ansible_facts.system == 'Linux'
- ansible_facts.os_family != 'Suse'
- ansible_facts.os_family != 'RedHat' or (ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_version is version('7.0', '=='))
- ansible_facts.os_family != 'Alpine'
block:
- name: "Install fatresize"
ansible.builtin.package:

View file

@ -3,12 +3,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Debug ansible_version
ansible.builtin.debug:
var: ansible_version
when: not (quiet_test | default(true) | bool)
tags: ansible_version
- name: Tests
ansible.builtin.assert:
that:

View file

@ -3,12 +3,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Debug ansible_version
debug:
var: ansible_version
when: debug_test|default(false)|bool
tags: t0
- name: 1. Test lists merged by attribute name
block:
- name: Test lists merged by attribute name debug

View file

@ -3,12 +3,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Debug ansible_version
ansible.builtin.debug:
var: ansible_version
when: not (quiet_test | default(true) | bool)
tags: ansible_version
- name: Tests
ansible.builtin.assert:
that:

View file

@ -3,12 +3,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Debug ansible_version
ansible.builtin.debug:
var: ansible_version
when: not (quiet_test | default(true) | bool)
tags: ansible_version
- name: Tests
ansible.builtin.assert:
that:

View file

@ -60,5 +60,5 @@
pkill -f -- '{{ remote_tmp_dir }}/serve.py'
when: |
ansible_distribution == 'Fedora' or
ansible_distribution == 'Ubuntu' and not ansible_distribution_major_version | int < 16
ansible_facts.distribution == 'Fedora' or
ansible_facts.distribution == 'Ubuntu' and not ansible_facts.distribution_major_version | int < 16

View file

@ -8,7 +8,7 @@
name: flatpak
state: present
become: true
when: ansible_distribution == 'Fedora'
when: ansible_facts.distribution == 'Fedora'
- block:
- name: Activate flatpak ppa on Ubuntu
@ -16,14 +16,14 @@
repo: ppa:alexlarsson/flatpak
state: present
mode: '0644'
when: ansible_lsb.major_release | int < 18
when: ansible_facts.lsb.major_release | int < 18
- name: Install flatpak package on Ubuntu
apt:
name: flatpak
state: present
when: ansible_distribution == 'Ubuntu'
when: ansible_facts.distribution == 'Ubuntu'
- name: Install dummy remote for user
flatpak_remote:
@ -62,7 +62,7 @@
mode: '0755'
- name: Start HTTP server
command: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/serve.py 127.0.0.1 8000 /tmp/flatpak/'
command: '{{ ansible_facts.python.executable }} {{ remote_tmp_dir }}/serve.py 127.0.0.1 8000 /tmp/flatpak/'
async: 120
poll: 0
register: webserver_status

View file

@ -46,5 +46,5 @@
method: system
when: |
ansible_distribution == 'Fedora' or
ansible_distribution == 'Ubuntu' and not ansible_distribution_major_version | int < 16
ansible_facts.distribution == 'Fedora' or
ansible_facts.distribution == 'Ubuntu' and not ansible_facts.distribution_major_version | int < 16

View file

@ -7,19 +7,19 @@
dnf:
name: flatpak
state: present
when: ansible_distribution == 'Fedora'
when: ansible_facts.distribution == 'Fedora'
- block:
- name: Activate flatpak ppa on Ubuntu versions older than 18.04/bionic
apt_repository:
repo: ppa:alexlarsson/flatpak
state: present
mode: '0644'
when: ansible_lsb.major_release | int < 18
when: ansible_facts.lsb.major_release | int < 18
- name: Install flatpak package on Ubuntu
apt:
name: flatpak
state: present
when: ansible_distribution == 'Ubuntu'
when: ansible_facts.distribution == 'Ubuntu'
- name: Install flatpak remote for testing check mode
flatpak_remote:
name: check-mode-test-remote

View file

@ -10,16 +10,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- when:
- not (ansible_os_family == 'Alpine') # TODO
- not (ansible_facts.os_family == 'Alpine') # TODO
block:
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
- '{{ ansible_facts.distribution }}.yml'
- '{{ ansible_facts.os_family }}.yml'
- 'default.yml'
paths: '../vars'
@ -28,7 +28,7 @@
name: "{{ item }}"
state: present
loop: "{{ test_packages }}"
when: ansible_distribution != "MacOSX"
when: ansible_facts.distribution != "MacOSX"
- name: Install a gem
gem:
@ -44,7 +44,7 @@
msg: "failed to install gem: {{ install_gem_result.msg }}"
when:
- install_gem_result is failed
- not (ansible_user_uid == 0 and "User --install-dir or --user-install but not both" not in install_gem_result.msg)
- not (ansible_facts.user_uid == 0 and "User --install-dir or --user-install but not both" not in install_gem_result.msg)
- block:
- name: List gems
@ -108,7 +108,7 @@
that:
- remove_gem_results is changed
- current_gems.stdout is not search('gist\s+\([0-9.]+\)')
when: ansible_user_uid == 0
when: ansible_facts.user_uid == 0
# Check custom gem directory
- name: Install gem in a custom directory with incorrect options
@ -217,12 +217,12 @@
community.general.gem:
name: json
state: absent
when: ansible_distribution == "Ubuntu"
when: ansible_facts.distribution == "Ubuntu"
register: gem_result
ignore_errors: true
- name: Assert gem uninstall failed as expected
when: ansible_distribution == "Ubuntu"
when: ansible_facts.distribution == "Ubuntu"
assert:
that:
- gem_result is failed

View file

@ -9,7 +9,7 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- when: ansible_distribution in ['MacOSX']
- when: ansible_facts.distribution in ['MacOSX']
block:
- include_tasks: 'formulae.yml'
- include_tasks: 'casks.yml'

View file

@ -12,13 +12,13 @@
- name: Find brew binary
command: which brew
register: brew_which
when: ansible_distribution in ['MacOSX']
when: ansible_facts.distribution in ['MacOSX']
- name: Get owner of brew binary
stat:
path: "{{ brew_which.stdout }}"
register: brew_stat
when: ansible_distribution in ['MacOSX']
when: ansible_facts.distribution in ['MacOSX']
- block:
- name: Install cask

View file

@ -18,7 +18,7 @@
- name: Install legacycrypt on Python 3.13+
pip:
name: legacycrypt
when: ansible_python_version is version("3.13", ">=")
when: ansible_facts.python_version is version("3.13", ">=")
- name: Check and start systemd-homed service
service:
@ -183,5 +183,5 @@
# homectl was first introduced in systemd 245 so check version >= 245 and make sure system has systemd and homectl command
when:
- systemd_version.rc == 0 and (systemd_version.stdout | regex_search('[0-9][0-9][0-9]') | int >= 245) and homectl_version.rc == 0
- ansible_distribution != 'Archlinux' # TODO!
- ansible_distribution != 'Fedora' or ansible_distribution_major_version|int < 36 # TODO!
- ansible_facts.distribution != 'Archlinux' # TODO!
- ansible_facts.distribution != 'Fedora' or ansible_facts.distribution_major_version|int < 36 # TODO!

View file

@ -9,4 +9,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- include_tasks: tests.yml
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
when: ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_release == 'trusty'

View file

@ -14,7 +14,7 @@
- set_fact:
validate_certs: false
when: (ansible_distribution == "MacOSX" and ansible_distribution_version == "10.11.1")
when: (ansible_facts.distribution == "MacOSX" and ansible_facts.distribution_version == "10.11.1")
- name: get information about current IP using ipify facts
ipify_facts:

View file

@ -52,12 +52,12 @@
- set_fact:
file_contents: "{{ get_file_content.stdout }}"
when: ansible_distribution == 'RedHat' and ansible_distribution_version is version('7.9', '==')
when: ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_version is version('7.9', '==')
- name: Get the content of file test02.cfg
set_fact:
file_contents: "{{ lookup('file', mount_root_dir + '/test02.cfg') }}"
when: not (ansible_distribution == 'RedHat' and ansible_distribution_version is version('7.9', '=='))
when: not (ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_version is version('7.9', '=='))
- fail: msg="Failed to replace the file test02.cfg"
when: file_contents != "test"

View file

@ -10,7 +10,7 @@
delete_files:
- "test01.cfg"
- debug: var=ansible_distribution
- debug: var=ansible_facts.distribution
- include_tasks: iso_mount.yml
vars:

View file

@ -3,7 +3,7 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- debug: var=ansible_distribution
- debug: var=ansible_facts.distribution
- block:
- name: "Mount customized ISO on MAC"
@ -20,7 +20,7 @@
- set_fact:
mount_root_dir: "{{ test_dir }}/iso_mount/CDROM"
when: iso_name.find('udf') != -1
when: ansible_distribution == "MacOSX"
when: ansible_facts.distribution == "MacOSX"
- block:
- name: "Mount {{ iso_name }} to {{ test_dir }}/iso_mount on localhost"
@ -36,4 +36,4 @@
- set_fact:
mount_root_dir: "{{ test_dir }}/iso_mount"
when:
- ansible_distribution != "MacOSX"
- ansible_facts.distribution != "MacOSX"

View file

@ -10,7 +10,7 @@
- name: Skip some platforms which does not support ansible.posix.mount
meta: end_play
when: ansible_distribution in ['Alpine']
when: ansible_facts.distribution in ['Alpine']
- set_fact:
test_dir: '{{ remote_tmp_dir }}/test_iso_customize'

View file

@ -33,13 +33,13 @@
- name: MACOS | Find brew binary
command: which brew
register: brew_which
when: ansible_distribution in ['MacOSX']
when: ansible_facts.distribution in ['MacOSX']
- name: MACOS | Get owner of brew binary
stat:
path: "{{ brew_which.stdout }}"
register: brew_stat
when: ansible_distribution in ['MacOSX']
when: ansible_facts.distribution in ['MacOSX']
- name: MACOS | Install 7zip package
homebrew:

View file

@ -17,14 +17,14 @@
- name: Doesn't work with Fedora 43 for some reason
meta: end_play
when:
- ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('43', '==')
- ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version is version('43', '==')
- name: Install EPEL repository (RHEL only)
include_role:
name: setup_epel
when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_major_version is version('9', '<')
- ansible_facts.distribution in ['RedHat', 'CentOS']
- ansible_facts.distribution_major_version is version('9', '<')
- name: Install 7zip
import_tasks: 7zip.yml

View file

@ -49,7 +49,7 @@
certificate_path: "{{ test_cert_path }}"
privatekey_path: "{{ test_key_path }}"
when:
- "not (ansible_os_family == 'RedHat' and ansible_distribution_version is version('8.0', '<'))"
- "not (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version is version('8.0', '<'))"
- name: Create the pkcs12 archive from the test x509 cert (command)
ansible.builtin.command:
@ -62,8 +62,8 @@
-passout stdin
stdin: "{{ test_keystore2_password }}"
when:
- "ansible_os_family == 'RedHat'"
- "ansible_distribution_version is version('8.0', '<')"
- "ansible_facts.os_family == 'RedHat'"
- "ansible_facts.distribution_version is version('8.0', '<')"
- name: Create the pkcs12 archive from the certificate we will be trying to add to the keystore
community.crypto.openssl_pkcs12:
@ -73,7 +73,7 @@
certificate_path: "{{ test_cert2_path }}"
privatekey_path: "{{ test_key2_path }}"
when:
- "not (ansible_os_family == 'RedHat' and ansible_distribution_version is version('8.0', '<'))"
- "not (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version is version('8.0', '<'))"
- name: Create the pkcs12 archive from the certificate we will be trying to add to the keystore (command)
ansible.builtin.command:
@ -86,8 +86,8 @@
-passout stdin
stdin: "{{ test_keystore2_password }}"
when:
- "ansible_os_family == 'RedHat'"
- "ansible_distribution_version is version('8.0', '<')"
- "ansible_facts.os_family == 'RedHat'"
- "ansible_facts.distribution_version is version('8.0', '<')"
#
# Run tests
@ -246,7 +246,7 @@
dest: "{{ remote_tmp_dir }}"
- name: Create an SSL server that we will use for testing URL imports
command: "{{ ansible_python.executable }} {{ remote_tmp_dir }}/setupSSLServer.py {{ remote_tmp_dir }} {{ test_ssl_port }}"
command: "{{ ansible_facts.python.executable }} {{ remote_tmp_dir }}/setupSSLServer.py {{ remote_tmp_dir }} {{ test_ssl_port }}"
async: 10
poll: 0

View file

@ -27,4 +27,4 @@
- test_reload
- test_runatload
when: ansible_os_family == 'Darwin'
when: ansible_facts.os_family == 'Darwin'

View file

@ -13,4 +13,4 @@
- include_tasks: "{{ item }}"
with_fileglob:
- 'tests/*.yml'
when: ansible_os_family in ['Ubuntu', 'Debian']
when: ansible_facts.os_family in ['Ubuntu', 'Debian']

View file

@ -13,4 +13,4 @@
- include_tasks: "{{ item }}"
with_fileglob:
- 'tests/*.yml'
when: ansible_os_family in ['Ubuntu', 'Debian']
when: ansible_facts.os_family in ['Ubuntu', 'Debian']

View file

@ -15,7 +15,7 @@
- net-tools
- netcat-openbsd
state: latest
when: ansible_os_family == "Debian"
when: ansible_facts.os_family == "Debian"
- name: install netstat and netcat on rh < 7
ansible.builtin.package:
@ -23,87 +23,87 @@
- net-tools
- nc.x86_64
state: latest
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7
when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int < 7
- name: install netcat on rh >= 7
ansible.builtin.package:
name: 'nmap-ncat'
state: latest
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7
when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7
- name: start UDP server on port 5555
command: nc -u -l -p 5555
async: 1000
poll: 0
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7) or ansible_os_family == "Debian"
when: (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7) or ansible_facts.os_family == "Debian"
- name: start UDP server on port 5555
command: nc -u -l 5555
async: 1000
poll: 0
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7
when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int < 7
- name: start TCP server on port 5556
command: "nc -l -p 5556"
async: 1000
poll: 0
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7) or ansible_os_family == "Debian"
when: (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7) or ansible_facts.os_family == "Debian"
- name: start TCP server on port 5556
command: "nc -l 5556"
async: 1000
poll: 0
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7
when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int < 7
- name: Gather listening ports facts
listen_ports_facts:
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Debian"
- name: check that the include_non_listening parameters ('state' and 'foreign_address') are not active in default setting
assert:
that:
- ansible_facts.tcp_listen | selectattr('state', 'defined') | list | length == 0
- ansible_facts.tcp_listen | selectattr('foreign_address', 'defined') | list | length == 0
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Debian"
- name: Gather listening ports facts explicitly via netstat and include_non_listening
listen_ports_facts:
command: 'netstat'
include_non_listening: 'yes'
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7) or ansible_os_family == "Debian"
when: (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int < 7) or ansible_facts.os_family == "Debian"
- name: Gather listening ports facts explicitly via ss and include_non_listening
listen_ports_facts:
command: 'ss'
include_non_listening: 'yes'
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7
when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7
- name: check for ansible_facts.udp_listen exists
assert:
that: ansible_facts.udp_listen is defined
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Debian"
- name: check for ansible_facts.tcp_listen exists
assert:
that: ansible_facts.tcp_listen is defined
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Debian"
- name: check that the include_non_listening parameter 'state' and 'foreign_address' exists
assert:
that:
- ansible_facts.tcp_listen | selectattr('state', 'defined') | list | length > 0
- ansible_facts.tcp_listen | selectattr('foreign_address', 'defined') | list | length > 0
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Debian"
- name: check TCP 5556 is in listening ports
assert:
that: 5556 in ansible_facts.tcp_listen | map(attribute='port') | sort | list
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7) or ansible_os_family == "Debian"
when: (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7) or ansible_facts.os_family == "Debian"
- name: check UDP 5555 is in listening ports
assert:
that: 5555 in ansible_facts.udp_listen | map(attribute='port') | sort | list
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7) or ansible_os_family == "Debian"
when: (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version|int >= 7) or ansible_facts.os_family == "Debian"
- name: kill all async commands
command: "kill -9 {{ item.pid }}"
@ -112,7 +112,7 @@
ignore_errors: true
- when: ansible_os_family == "Debian"
- when: ansible_facts.os_family == "Debian"
block:
- name: Remove netstat and ss dependencies to simulate missing executables
ansible.builtin.package:

View file

@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Arch-less block
when: ansible_distribution not in ['Archlinux']
when: ansible_facts.distribution not in ['Archlinux']
block:
- name: Is the locale we're going to test against installed?
command: locale -a

View file

@ -10,7 +10,7 @@
- name: Bail out if not supported
ansible.builtin.meta: end_play
when: ansible_distribution not in ('Ubuntu', 'Debian', 'Archlinux')
when: ansible_facts.distribution not in ('Ubuntu', 'Debian', 'Archlinux')
- name: Run tests auto-detecting mechanism
ansible.builtin.include_tasks: basic.yml

View file

@ -13,4 +13,4 @@
- name: Setup test data
script: test_db.py
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ ansible_facts.python.executable }}"

View file

@ -5,9 +5,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
#}
[security_privacy]
name=Crypto applications and utilities (openSUSE_Leap_{{ ansible_distribution_version }})
name=Crypto applications and utilities (openSUSE_Leap_{{ ansible_facts.distribution_version }})
type=rpm-md
baseurl=http://download.opensuse.org/repositories/security:/privacy/openSUSE_Leap_{{ ansible_distribution_version }}/
baseurl=http://download.opensuse.org/repositories/security:/privacy/openSUSE_Leap_{{ ansible_facts.distribution_version }}/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/security:/privacy/openSUSE_Leap_{{ ansible_distribution_version }}/repodata/repomd.xml.key
gpgkey=http://download.opensuse.org/repositories/security:/privacy/openSUSE_Leap_{{ ansible_facts.distribution_version }}/repodata/repomd.xml.key
enabled=1

View file

@ -12,7 +12,7 @@
package:
name: lvm2
state: present
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
- name: Test lvg module
block:

View file

@ -11,14 +11,14 @@
- name: "get lvm facts"
setup:
- debug: var=ansible_lvm
- debug: var=ansible_facts.lvm
- name: "Assert the testvg span only on first disk"
assert:
that:
- ansible_lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device2].vg == ""'
- ansible_facts.lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2 not in ansible_facts.lvm.pvs or
ansible_facts.lvm.pvs[loop_device2].vg == ""'
- name: "Extend to second disk AND reduce from the first disk"
lvg:
@ -28,11 +28,11 @@
- name: "get lvm facts"
setup:
- debug: var=ansible_lvm
- debug: var=ansible_facts.lvm
- name: "Assert the testvg span only on first disk"
assert:
that:
- 'loop_device1 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device1].vg == ""'
- ansible_lvm.pvs[loop_device2].vg == "testvg"
- 'loop_device1 not in ansible_facts.lvm.pvs or
ansible_facts.lvm.pvs[loop_device1].vg == ""'
- ansible_facts.lvm.pvs[loop_device2].vg == "testvg"

View file

@ -13,14 +13,14 @@
- name: "get lvm facts"
setup:
- debug: var=ansible_lvm
- debug: var=ansible_facts.lvm
- name: "Assert the testvg span only on first disk"
assert:
that:
- ansible_lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device2].vg == ""'
- ansible_facts.lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2 not in ansible_facts.lvm.pvs or
ansible_facts.lvm.pvs[loop_device2].vg == ""'
- name: "Extend to second disk AND keep first disk"
lvg:
@ -31,10 +31,10 @@
- name: "get lvm facts"
setup:
- debug: var=ansible_lvm
- debug: var=ansible_facts.lvm
- name: "Assert the testvg spans on both disks"
assert:
that:
- ansible_lvm.pvs[loop_device1].vg == "testvg"
- ansible_lvm.pvs[loop_device2].vg == "testvg"
- ansible_facts.lvm.pvs[loop_device1].vg == "testvg"
- ansible_facts.lvm.pvs[loop_device2].vg == "testvg"

View file

@ -10,7 +10,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Install required packages (Linux)
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
ansible.builtin.package:
name: lvm2
state: present

View file

@ -10,7 +10,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Install required packages (Linux)
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
ansible.builtin.package:
name: lvm2
state: present

View file

@ -10,7 +10,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Install required packages (Linux)
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
ansible.builtin.package:
name:
- lvm2

View file

@ -12,7 +12,7 @@
package:
name: lvm2
state: present
when: ansible_system == 'Linux'
when: ansible_facts.system == 'Linux'
- name: Test lvol module
block:

View file

@ -12,7 +12,7 @@
- when:
# TODO: https://github.com/ansible-collections/community.general/issues/4656
- ansible_python.version.major != 3 or ansible_python.version.minor < 12
- ansible_facts.python.version.major != 3 or ansible_facts.python.version.minor < 12
block:
# NOTE: If the system does not support smtpd-tls (python 2.6 and older) we do basic tests
@ -35,7 +35,7 @@
# FIXME: Verify the mail after it was send would be nice
# This would require either dumping the content, or registering async task output
- name: Start test smtpserver
shell: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/smtpserver.py 10025:10465'
shell: '{{ ansible_facts.python.executable }} {{ remote_tmp_dir }}/smtpserver.py 10025:10465'
async: 45
poll: 0
register: smtpserver

View file

@ -13,8 +13,8 @@
include_role:
name: setup_epel
when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_major_version is version('9', '<')
- ansible_facts.distribution in ['RedHat', 'CentOS']
- ansible_facts.distribution_major_version is version('9', '<')
- name: create required directories
become: true
@ -36,7 +36,7 @@
with_first_found:
- files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.os_family }}.yml'
- 'defaults.yml'
- name: monit config
@ -55,13 +55,13 @@
package:
name: virtualenv
state: present
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8'
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
- name: Install virtualenv on Arch Linux
pip:
name: virtualenv
state: present
when: ansible_os_family == 'Archlinux'
when: ansible_facts.os_family == 'Archlinux'
- name: install dependencies
pip:

View file

@ -10,5 +10,5 @@
- include_tasks: ubuntu.yml
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release not in ['focal', 'jammy', 'noble']
- ansible_facts.distribution == 'Ubuntu'
- ansible_facts.distribution_release not in ['focal', 'jammy', 'noble']

View file

@ -7,13 +7,13 @@
meta: end_play
# TODO: figure out why Alpine does not work!
when: |
ansible_distribution == 'CentOS' and ansible_distribution_major_version is not version('7', '>=')
or ansible_distribution == 'Alpine'
ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version is not version('7', '>=')
or ansible_facts.distribution == 'Alpine'
- name: Install Nomad and test
vars:
nomad_version: 0.12.4
nomad_uri: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_{{ ansible_system | lower }}_{{ nomad_arch }}.zip
nomad_uri: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_{{ ansible_facts.system | lower }}_{{ nomad_arch }}.zip
nomad_cmd: '{{ remote_tmp_dir }}/nomad'
block:
@ -23,7 +23,7 @@
extra_args: "-c {{ remote_constraints }}"
register: result
until: result is success
when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=')
when: ansible_facts.distribution_file_variety|default() == 'RedHat' and ansible_facts.distribution_major_version is version('6', '<=')
- name: Install python-nomad
pip:
@ -64,18 +64,18 @@
name: unzip
register: result
until: result is success
when: ansible_distribution != "MacOSX"
when: ansible_facts.distribution != "MacOSX"
- assert:
that: ansible_architecture in ['i386', 'x86_64', 'amd64']
that: ansible_facts.architecture in ['i386', 'x86_64', 'amd64']
- set_fact:
nomad_arch: '386'
when: ansible_architecture == 'i386'
when: ansible_facts.architecture == 'i386'
- set_fact:
nomad_arch: amd64
when: ansible_architecture in ['x86_64', 'amd64']
when: ansible_facts.architecture in ['x86_64', 'amd64']
- name: Download nomad binary
unarchive:

View file

@ -13,7 +13,7 @@
# Setup steps
- when:
- not (ansible_os_family == 'Alpine') # TODO
- not (ansible_facts.os_family == 'Alpine') # TODO
block:
# expand remote path
@ -25,7 +25,7 @@
- include_tasks: run.yml
vars:
nodejs_version: '{{ item }}'
nodejs_path: 'node-v{{ nodejs_version }}-{{ ansible_system|lower }}-x{{ ansible_userspace_bits }}'
nodejs_path: 'node-v{{ nodejs_version }}-{{ ansible_facts.system|lower }}-x{{ ansible_facts.userspace_bits }}'
with_items:
- 7.10.1 # provides npm 4.2.0 (last npm < 5 released)
- 8.0.0 # provides npm 5.0.0

View file

@ -15,7 +15,7 @@
block:
- shell: npm --version
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
PATH: '{{ node_path }}:{{ ansible_facts.env.PATH }}'
register: npm_version
- debug:
@ -29,7 +29,7 @@
name: '{{ package }}'
no_bin_links: false
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
PATH: '{{ node_path }}:{{ ansible_facts.env.PATH }}'
register: npm_install_no_bin_links_disabled
- name: 'Make sure .bin folder has been created'
@ -50,7 +50,7 @@
name: '{{ package }}'
no_bin_links: true
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
PATH: '{{ node_path }}:{{ ansible_facts.env.PATH }}'
register: npm_install_no_bin_links_enabled
- name: 'Make sure .bin folder has not been created'

View file

@ -13,7 +13,7 @@
node_path: '{{ remote_dir }}/{{ nodejs_path }}/bin'
package: 'iconv-lite'
environment:
PATH: '{{ node_path }}:{{ ansible_env.PATH }}'
PATH: '{{ node_path }}:{{ ansible_facts.env.PATH }}'
block:
- shell: npm --version
register: npm_version

View file

@ -3,9 +3,9 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: "Install {{ ansible_os_family }} Libraries"
- name: "Install {{ ansible_facts.os_family }} Libraries"
package:
name: "{{ packages[ansible_os_family] }}"
name: "{{ packages[ansible_facts.os_family] }}"
- name: "Install pyodbc"
pip:

View file

@ -9,12 +9,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- debug:
msg: "{{ ansible_os_family }} / {{ ansible_distribution }} / {{ ansible_distribution_major_version }}"
msg: "{{ ansible_facts.os_family }} / {{ ansible_facts.distribution }} / {{ ansible_facts.distribution_major_version }}"
- when:
- ansible_os_family != 'Archlinux' # TODO install driver from AUR: https://aur.archlinux.org/packages/psqlodbc
- ansible_os_family != 'RedHat' or ansible_distribution_major_version != '7' # CentOS 7 stopped working
- ansible_distribution != 'Debian' or ansible_distribution_major_version != '13' # TODO fix tests for Debian 13 (Trixie)!
- ansible_facts.os_family != 'Archlinux' # TODO install driver from AUR: https://aur.archlinux.org/packages/psqlodbc
- ansible_facts.os_family != 'RedHat' or ansible_facts.distribution_major_version != '7' # CentOS 7 stopped working
- ansible_facts.distribution != 'Debian' or ansible_facts.distribution_major_version != '13' # TODO fix tests for Debian 13 (Trixie)!
block:
#
@ -22,7 +22,7 @@
#
# Some of the docker images already have pyodbc installed on it
- include_tasks: no_pyodbc.yml
when: ansible_os_family != 'FreeBSD' and ansible_os_family != 'Suse' and ansible_os_family != 'Debian'
when: ansible_facts.os_family != 'FreeBSD' and ansible_facts.os_family != 'Suse' and ansible_facts.os_family != 'Debian'
#
# Get pyodbc installed
@ -40,17 +40,17 @@
- name: Changing DSN for Suse
set_fact:
dsn: "DRIVER={PSQL};Server=localhost;Port=5432;Database=postgres;Uid={{ my_user }};Pwd={{ my_pass_decrypted }};UseUnicode=True"
when: ansible_os_family == 'Suse' or ansible_os_family == 'Alpine'
when: ansible_facts.os_family == 'Suse' or ansible_facts.os_family == 'Alpine'
- name: Changing DSN for Alpine
set_fact:
dsn: "DRIVER={/usr/lib/psqlodbcw.so};Server=localhost;Port=5432;Database=postgres;Uid={{ my_user }};Pwd={{ my_pass_decrypted }};UseUnicode=True"
when: ansible_os_family == 'Alpine'
when: ansible_facts.os_family == 'Alpine'
- name: Changing DSN for Debian
set_fact:
dsn: "DRIVER={PostgreSQL Unicode};Server=localhost;Port=5432;Database=postgres;Uid={{ my_user }};Pwd={{ my_pass_decrypted }};UseUnicode=True"
when: ansible_os_family == 'Debian'
when: ansible_facts.os_family == 'Debian'
#
# Name setup database

View file

@ -8,7 +8,7 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- when: ansible_os_family == 'Archlinux'
- when: ansible_facts.os_family == 'Archlinux'
block:
# Add more tests here by including more task files:
- include_tasks: 'basic.yml'

View file

@ -6,7 +6,7 @@
package:
name: parted
state: present
when: ansible_os_family == 'Alpine'
when: ansible_facts.os_family == 'Alpine'
- name: Create empty file
community.general.filesize:

View file

@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Bail out if Python < 3.8
when: ansible_python_version is version('3.8', '<')
when: ansible_facts.python_version is version('3.8', '<')
ansible.builtin.meta: end_play
- name: Install pipx>=1.7.0
ansible.builtin.pip:

View file

@ -5,7 +5,7 @@
- name: Set up environment
environment:
PATH: /root/.local/bin:/usr/local/bin:{{ ansible_env.PATH }}
PATH: /root/.local/bin:/usr/local/bin:{{ ansible_facts.env.PATH }}
block:
- name: Remove global pipx dir
ansible.builtin.file:

View file

@ -5,7 +5,7 @@
- name: Set up environment
environment:
PATH: /usr/local/bin:{{ ansible_env.PATH }}
PATH: /usr/local/bin:{{ ansible_facts.env.PATH }}
block:
- name: Uninstall pycowsay and black
community.general.pipx:

View file

@ -5,7 +5,7 @@
- name: Set up environment
environment:
PATH: /usr/local/bin:{{ ansible_env.PATH }}
PATH: /usr/local/bin:{{ ansible_facts.env.PATH }}
block:
- name: Uninstall pycowsay and black
community.general.pipx:

View file

@ -5,7 +5,7 @@
- name: Set up environment
environment:
PATH: /usr/local/bin:{{ ansible_env.PATH }}
PATH: /usr/local/bin:{{ ansible_facts.env.PATH }}
block:
- name: Uninstall pycowsay
community.general.pipx:

View file

@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Bail out if Python < 3.8
when: ansible_python_version is version('3.8', '<')
when: ansible_facts.python_version is version('3.8', '<')
ansible.builtin.meta: end_play
- name: Install pipx>=1.7.0
ansible.builtin.pip:

View file

@ -267,7 +267,7 @@
# NOTE: FreeBSD 12.0 test runner receives a "connection reset by peer" after ~20% downloaded so we are
# only running this on 12.1 or higher
#
when: ansible_distribution_version is version('12.01', '>=')
when: ansible_facts.distribution_version is version('12.01', '>=')
block:
- name: Install GNU autotools
pkgng:
@ -539,9 +539,9 @@
# See also
# https://github.com/ansible-collections/community.general/issues/5795
when: >-
(ansible_distribution_version is version('12.01', '>=') and ansible_distribution_version is version('12.3', '<'))
or (ansible_distribution_version is version('13.6', '>=') and ansible_distribution_version is version('14.0', '<'))
or ansible_distribution_version is version('14.4', '>=')
(ansible_facts.distribution_version is version('12.01', '>=') and ansible_facts.distribution_version is version('12.3', '<'))
or (ansible_facts.distribution_version is version('13.6', '>=') and ansible_facts.distribution_version is version('14.0', '<'))
or ansible_facts.distribution_version is version('14.4', '>=')
block:
- name: Setup testjail
include_tasks: setup-testjail.yml

View file

@ -21,7 +21,7 @@
copy:
dest: /etc/pf.conf
content: |
nat on {{ ansible_default_ipv4.interface }} from 127.0.1.0/24 -> {{ ansible_default_ipv4.interface }}:0
nat on {{ ansible_facts.default_ipv4.interface }} from 127.0.1.0/24 -> {{ ansible_facts.default_ipv4.interface }}:0
validate: "pfctl -nf %s"
- name: Start pf firewall
@ -35,14 +35,14 @@
name: ezjail
- name: Configure ezjail to use http
when: ansible_distribution_version is version('11.01', '>')
when: ansible_facts.distribution_version is version('11.01', '>')
lineinfile:
dest: /usr/local/etc/ezjail.conf
regexp: ^ezjail_ftphost
line: ezjail_ftphost=http://ftp.freebsd.org
- name: Configure ezjail to use archive for old freebsd releases
when: ansible_distribution_version is version('11.01', '<=')
when: ansible_facts.distribution_version is version('11.01', '<=')
lineinfile:
dest: /usr/local/etc/ezjail.conf
regexp: ^ezjail_ftphost

View file

@ -16,12 +16,12 @@
- name: Run tests on OSes
ansible.builtin.include_tasks: run.yml
vars:
ansible_system_os: "{{ ansible_system | lower }}"
ansible_system_os: "{{ ansible_facts.system | lower }}"
nodejs_version: "{{ item.node_version }}"
nodejs_path: "node-v{{ nodejs_version }}-{{ ansible_system_os }}-x{{ ansible_userspace_bits }}"
nodejs_path: "node-v{{ nodejs_version }}-{{ ansible_system_os }}-x{{ ansible_facts.userspace_bits }}"
pnpm_version: "{{ item.pnpm_version }}"
pnpm_path: "pnpm-{{ 'macos' if ansible_system_os == 'darwin' else 'linuxstatic' }}-x{{ ansible_userspace_bits }}"
pnpm_path: "pnpm-{{ 'macos' if ansible_system_os == 'darwin' else 'linuxstatic' }}-x{{ ansible_facts.userspace_bits }}"
with_items:
- { node_version: 16.20.0, pnpm_version: 8.7.0 }
when:
- not(ansible_distribution == 'Alpine') and not(ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6')
- not(ansible_facts.distribution == 'Alpine') and not(ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '6')

View file

@ -25,9 +25,9 @@
- name: Setting up pnpm via command
ansible.builtin.command: "{{ tmp_dir.path }}/pnpm setup --force"
environment:
PNPM_HOME: "{{ ansible_env.HOME }}/.local/share/pnpm"
PNPM_HOME: "{{ ansible_facts.env.HOME }}/.local/share/pnpm"
SHELL: /bin/sh
ENV: "{{ ansible_env.HOME }}/.shrc"
ENV: "{{ ansible_facts.env.HOME }}/.shrc"
- name: Remove the temporary directory
ansible.builtin.file:
@ -42,10 +42,10 @@
- name: CI tests to run
vars:
node_bin_path: "{{ remote_tmp_dir }}/{{ nodejs_path }}/bin"
pnpm_bin_path: "{{ ansible_env.HOME }}/.local/share/pnpm"
pnpm_bin_path: "{{ ansible_facts.env.HOME }}/.local/share/pnpm"
package: "tailwindcss"
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
block:
- name: Create dummy package.json
@ -60,7 +60,7 @@
executable: "{{ pnpm_bin_path }}/pnpm"
state: present
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
- name: Install the same package from package.json again
pnpm:
@ -69,7 +69,7 @@
name: "reading-time"
state: present
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_install
- name: Assert that result is not changed
@ -83,7 +83,7 @@
executable: "{{ pnpm_bin_path }}/pnpm"
state: present
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
check_mode: true
register: pnpm_install_check
@ -102,7 +102,7 @@
state: present
name: "{{ package }}"
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_install
- name: Assert that result is changed and successful
@ -118,7 +118,7 @@
state: present
name: "{{ package }}"
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_reinstall
- name: Assert that there is no change
@ -134,7 +134,7 @@
state: latest
name: "{{ package }}"
environment:
PATH: "{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_fix_install
- name: Assert that result is changed and successful
@ -150,7 +150,7 @@
path: "{{ remote_tmp_dir }}"
state: present
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_install
- name: Assert that package with version is installed
@ -166,7 +166,7 @@
path: "{{ remote_tmp_dir }}"
state: present
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_reinstall
- name: Assert that there is no change
@ -181,7 +181,7 @@
path: "{{ remote_tmp_dir }}"
state: latest
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_update
- name: Assert that result is changed and successful
@ -196,7 +196,7 @@
path: "{{ remote_tmp_dir }}"
state: absent
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_absent
- name: Assert that result is changed and successful
@ -213,7 +213,7 @@
path: "{{ remote_tmp_dir }}"
state: present
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_install
- name: Assert that package with version and alias is installed
@ -230,7 +230,7 @@
path: "{{ remote_tmp_dir }}"
state: present
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_reinstall
- name: Assert that there is no change
@ -246,7 +246,7 @@
path: "{{ remote_tmp_dir }}"
state: absent
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
register: pnpm_absent
- name: Assert that result is changed and successful
@ -262,7 +262,7 @@
state: present
global: true
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
PNPM_HOME: "{{ pnpm_bin_path }}"
register: pnpm_install
@ -278,7 +278,7 @@
state: present
global: true
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
PNPM_HOME: "{{ pnpm_bin_path }}"
register: pnpm_reinstall
@ -294,7 +294,7 @@
state: latest
global: true
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
PNPM_HOME: "{{ pnpm_bin_path }}"
register: pnpm_reinstall
@ -311,7 +311,7 @@
global: true
state: absent
environment:
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}"
PATH: "{{ pnpm_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}"
PNPM_HOME: "{{ pnpm_bin_path }}"
register: pnpm_absent

View file

@ -12,7 +12,7 @@
pip:
name: setuptools
state: present
when: ansible_facts.distribution == 'MacOSX' and ansible_distribution_version is version('15', '>=')
when: ansible_facts.distribution == 'MacOSX' and ansible_facts.distribution_version is version('15', '>=')
- name: run python_requirements_info module
python_requirements_info:
@ -23,7 +23,7 @@
that:
- "'python' in basic_info"
- "'python_version' in basic_info"
- basic_info.python_version_info == ansible_python.version
- basic_info.python_version_info == ansible_facts.python.version
- name: run python_requirements_info module
python_requirements_info:

View file

@ -8,14 +8,14 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# FIXME: Unfortunately ansible_selinux could be a boolean or a dictionary !
# FIXME: Unfortunately ansible_facts.selinux could be a boolean or a dictionary !
- debug:
msg: SELinux is disabled
when: ansible_selinux is defined and ansible_selinux == False
when: ansible_facts.selinux is defined and ansible_facts.selinux == False
- debug:
msg: SELinux is {{ ansible_selinux.status }}
when: ansible_selinux is defined and ansible_selinux != False
msg: SELinux is {{ ansible_facts.selinux.status }}
when: ansible_facts.selinux is defined and ansible_facts.selinux != False
- include_tasks: sefcontext.yml
when: ansible_selinux is defined and ansible_selinux != False and ansible_selinux.status == 'enabled'
when: ansible_facts.selinux is defined and ansible_facts.selinux != False and ansible_facts.selinux.status == 'enabled'

View file

@ -7,15 +7,15 @@
package:
name: policycoreutils-python
when:
- ansible_distribution == 'RedHat'
- ansible_distribution_major_version|int < 8
- ansible_facts.distribution == 'RedHat'
- ansible_facts.distribution_major_version|int < 8
- name: install requirements for rhel8 beta
package:
name: python3-policycoreutils
when:
- ansible_distribution == 'RedHat'
- ansible_distribution_major_version|int >= 8
- ansible_facts.distribution == 'RedHat'
- ansible_facts.distribution_major_version|int >= 8
- name: Ensure we start with a clean state
sefcontext:

View file

@ -12,7 +12,7 @@
apt:
name: "{{item}}"
state: present
when: "ansible_os_family == 'Debian'"
when: "ansible_facts.os_family == 'Debian'"
with_items:
- apache2
- libapache2-mod-evasive
@ -21,10 +21,10 @@
community.general.zypper:
name: apache2
state: present
when: "ansible_os_family == 'Suse'"
when: "ansible_facts.os_family == 'Suse'"
- name: Enable mod_slotmem_shm on SuSE
apache2_module:
name: slotmem_shm
state: present
when: "ansible_os_family == 'Suse'"
when: "ansible_facts.os_family == 'Suse'"

View file

@ -9,16 +9,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- when:
- not (ansible_os_family == 'Alpine' and ansible_distribution_version is version('3.15', '<')) # TODO
- not (ansible_facts.os_family == 'Alpine' and ansible_facts.distribution_version is version('3.15', '<')) # TODO
block:
- name: Include distribution specific variables
include_vars: '{{ lookup(''first_found'', search) }}'
vars:
search:
files:
- '{{ ansible_distribution | lower }}.yml'
- '{{ ansible_os_family | lower }}.yml'
- '{{ ansible_system | lower }}.yml'
- '{{ ansible_facts.distribution | lower }}.yml'
- '{{ ansible_facts.os_family | lower }}.yml'
- '{{ ansible_facts.system | lower }}.yml'
- default.yml
paths:
- vars
@ -38,7 +38,7 @@
- name: Find libfaketime path
shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1'
register: libfaketime_path
- when: ansible_service_mgr == 'systemd'
- when: ansible_facts.service_mgr == 'systemd'
block:
- name: create directory for cron drop-in file
file:
@ -60,7 +60,7 @@
owner: root
group: root
mode: '0644'
- when: ansible_system == 'FreeBSD'
- when: ansible_facts.system == 'FreeBSD'
name: Use faketime with cron service
copy:
content: cron_env='LD_PRELOAD={{ libfaketime_path.stdout_lines[0].strip() }} FAKETIME="+0y x10"'
@ -70,6 +70,6 @@
mode: '0644'
- name: enable cron service
service:
daemon-reload: '{{ (ansible_service_mgr == ''systemd'') | ternary(true, omit) }}'
daemon-reload: '{{ (ansible_facts.service_mgr == ''systemd'') | ternary(true, omit) }}'
name: '{{ cron_service }}'
state: restarted

View file

@ -16,8 +16,8 @@
include_role:
name: setup_epel
when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_major_version is version('9', '<')
- ansible_facts.distribution in ['RedHat', 'CentOS']
- ansible_facts.distribution_major_version is version('9', '<')
- name: Distribution specific
block:

View file

@ -10,7 +10,7 @@
- name: Install EPEL
yum:
name: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
name: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm
disable_gpg_check: true
when:
- ansible_facts.distribution in ['RedHat', 'CentOS']
@ -18,7 +18,7 @@
- name: Install EPEL
yum:
name: https://ci-files.testing.ansible.com/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
name: https://ci-files.testing.ansible.com/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm
disable_gpg_check: true
when:
- ansible_facts.distribution in ['RedHat', 'CentOS']

View file

@ -18,10 +18,10 @@
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
- '{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml'
- '{{ ansible_facts.os_family }}.yml'
- 'default.yml'
paths: '../vars'
@ -90,4 +90,4 @@
- _testetcd3ctl.rc != 0
when:
- ansible_distribution | lower ~ "-" ~ ansible_distribution_major_version | lower != 'centos-6'
- ansible_facts.distribution | lower ~ "-" ~ ansible_facts.distribution_major_version | lower != 'centos-6'

View file

@ -10,8 +10,8 @@
- name: Set up dummy flatpak repository remote
when: |
ansible_distribution == 'Fedora' or
ansible_distribution == 'Ubuntu' and not ansible_distribution_major_version | int < 16
ansible_facts.distribution == 'Fedora' or
ansible_facts.distribution == 'Ubuntu' and not ansible_facts.distribution_major_version | int < 16
block:
- name: Copy repo into place
unarchive:

View file

@ -9,4 +9,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- include_tasks: setup.yml
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
when: ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_release == 'trusty'

View file

@ -11,8 +11,8 @@
- set_fact:
has_java_keytool: >-
{{
ansible_os_family not in ['Darwin', 'FreeBSD']
and not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<"))
ansible_facts.os_family not in ['Darwin', 'FreeBSD']
and not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_version is version("7.0", "<"))
}}
- name: Include OS-specific variables
@ -20,10 +20,10 @@
vars:
params:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml'
- '{{ ansible_facts.distribution }}.yml'
- '{{ ansible_facts.os_family }}.yml'
paths:
- '{{ role_path }}/vars'
when: has_java_keytool

View file

@ -9,4 +9,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- include_tasks: ubuntu.yml
when: ansible_distribution == 'Ubuntu'
when: ansible_facts.distribution == 'Ubuntu'

Some files were not shown because too many files have changed in this diff Show more