From 476f2bf641be86fc33528af90d13f46cd4c1f392 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 7 Feb 2026 18:18:48 +0100 Subject: [PATCH] Integration tests: replace ansible_xxx with ansible_facts.xxx (#11479) Replace ansible_xxx with ansible_facts.xxx. --- .../targets/alternatives/tasks/main.yml | 8 +-- .../targets/alternatives/tasks/setup.yml | 4 +- .../targets/alternatives/tasks/setup_test.yml | 4 +- .../targets/alternatives/tasks/test.yml | 4 +- .../targets/alternatives/tasks/tests.yml | 2 +- .../targets/android_sdk/tasks/main.yml | 8 +-- .../targets/android_sdk/tasks/setup.yml | 12 ++--- .../targets/apache2_mod_proxy/tasks/main.yml | 8 +-- .../apache2_module/tasks/actualtest.yml | 4 +- .../targets/apache2_module/tasks/main.yml | 4 +- tests/integration/targets/apk/tasks/main.yml | 2 +- .../integration/targets/cargo/tasks/main.yml | 2 +- .../integration/targets/cargo/tasks/setup.yml | 14 ++--- .../cloud_init_data_facts/tasks/main.yml | 24 ++++----- .../targets/cmd_runner/vars/main.yml | 8 +-- .../integration/targets/consul/tasks/main.yml | 12 ++--- tests/integration/targets/copr/tasks/main.yml | 10 ++-- tests/integration/targets/copr/vars/main.yml | 4 +- .../integration/targets/cpanm/tasks/main.yml | 10 ++-- .../targets/decompress/tasks/main.yml | 10 ++-- .../targets/discord/tasks/main.yml | 2 +- .../targets/dnf_versionlock/tasks/main.yml | 4 +- .../targets/dpkg_divert/tasks/main.yml | 2 +- .../targets/ejabberd_user/tasks/main.yml | 10 ++-- .../integration/targets/etcd3/tasks/main.yml | 2 +- .../targets/filesize/tasks/main.yml | 2 +- .../targets/filesystem/tasks/create_fs.yml | 6 +-- .../targets/filesystem/tasks/main.yml | 48 ++++++++--------- .../filesystem/tasks/reset_fs_uuid.yml | 6 +-- .../tasks/set_fs_uuid_on_creation.yml | 2 +- .../targets/filesystem/tasks/setup.yml | 46 ++++++++-------- .../targets/filter_keep_keys/tasks/tests.yml | 6 --- .../tasks/lists_mergeby_default.yml | 6 --- .../filter_remove_keys/tasks/tests.yml | 6 --- .../filter_replace_keys/tasks/tests.yml | 6 --- .../targets/flatpak/tasks/main.yml | 4 +- .../targets/flatpak/tasks/setup.yml | 8 +-- .../targets/flatpak_remote/tasks/main.yml | 4 +- .../targets/flatpak_remote/tasks/setup.yml | 6 +-- tests/integration/targets/gem/tasks/main.yml | 20 +++---- .../targets/homebrew/tasks/main.yml | 2 +- .../targets/homebrew_cask/tasks/main.yml | 4 +- .../targets/homectl/tasks/main.yml | 6 +-- .../targets/influxdb_user/tasks/main.yml | 2 +- .../targets/ipify_facts/tasks/main.yml | 2 +- .../iso_customize/tasks/iso_customize.yml | 4 +- .../tasks/iso_customize_delete_files.yml | 2 +- .../targets/iso_customize/tasks/iso_mount.yml | 6 +-- .../targets/iso_customize/tasks/main.yml | 2 +- .../targets/iso_extract/tasks/7zip.yml | 4 +- .../targets/iso_extract/tasks/main.yml | 6 +-- .../targets/java_cert/tasks/state_change.yml | 14 ++--- .../targets/launchd/tasks/main.yml | 2 +- .../targets/ldap_inc/tasks/main.yml | 2 +- .../targets/ldap_search/tasks/main.yml | 2 +- .../targets/listen_ports_facts/tasks/main.yml | 34 ++++++------ .../locale_gen/tasks/11046-usrlocal.yml | 2 +- .../targets/locale_gen/tasks/main.yml | 2 +- .../targets/lookup_lmdb_kv/dependencies.yml | 2 +- .../templates/security-privacy.repo.j2 | 6 +-- tests/integration/targets/lvg/tasks/main.yml | 2 +- .../targets/lvg/tasks/test_grow_reduce.yml | 16 +++--- .../lvg/tasks/test_remove_extra_pvs.yml | 14 ++--- .../targets/lvg_rename/tasks/main.yml | 2 +- .../integration/targets/lvm_pv/tasks/main.yml | 2 +- .../targets/lvm_pv_move_data/tasks/main.yml | 2 +- tests/integration/targets/lvol/tasks/main.yml | 2 +- tests/integration/targets/mail/tasks/main.yml | 4 +- .../integration/targets/monit/tasks/main.yml | 10 ++-- tests/integration/targets/mqtt/tasks/main.yml | 4 +- .../integration/targets/nomad/tasks/main.yml | 16 +++--- tests/integration/targets/npm/tasks/main.yml | 4 +- .../targets/npm/tasks/no_bin_links.yml | 6 +-- tests/integration/targets/npm/tasks/test.yml | 2 +- .../targets/odbc/tasks/install_pyodbc.yml | 4 +- tests/integration/targets/odbc/tasks/main.yml | 16 +++--- .../integration/targets/pacman/tasks/main.yml | 2 +- .../integration/targets/parted/tasks/main.yml | 2 +- tests/integration/targets/pipx/tasks/main.yml | 2 +- .../pipx/tasks/testcase-8793-global.yml | 2 +- .../pipx/tasks/testcase-8809-installall.yml | 2 +- .../targets/pipx/tasks/testcase-8809-pin.yml | 2 +- .../pipx/tasks/testcase-8809-uninjectpkg.yml | 2 +- .../targets/pipx_info/tasks/main.yml | 2 +- .../targets/pkgng/tasks/freebsd.yml | 8 +-- .../targets/pkgng/tasks/setup-testjail.yml | 6 +-- tests/integration/targets/pnpm/tasks/main.yml | 8 +-- tests/integration/targets/pnpm/tasks/run.yml | 42 +++++++-------- .../python_requirements_info/tasks/main.yml | 4 +- .../targets/sefcontext/tasks/main.yml | 10 ++-- .../targets/sefcontext/tasks/sefcontext.yml | 8 +-- .../targets/setup_apache2/tasks/main.yml | 6 +-- .../targets/setup_cron/tasks/main.yml | 14 ++--- .../targets/setup_docker/tasks/main.yml | 4 +- .../targets/setup_epel/tasks/main.yml | 4 +- .../targets/setup_etcd3/tasks/main.yml | 10 ++-- .../setup_flatpak_remote/tasks/main.yaml | 4 +- .../targets/setup_influxdb/tasks/main.yml | 2 +- .../targets/setup_java_keytool/tasks/main.yml | 12 ++--- .../targets/setup_mosquitto/tasks/main.yml | 2 +- .../targets/setup_openldap/tasks/main.yml | 4 +- .../targets/setup_openssl/tasks/main.yml | 12 ++--- .../targets/setup_openssl/vars/CentOS-8.yml | 2 +- .../targets/setup_openssl/vars/FreeBSD.yml | 4 +- .../targets/setup_paramiko/tasks/main.yml | 4 +- .../targets/setup_pkg_mgr/tasks/archlinux.yml | 2 +- .../targets/setup_pkg_mgr/tasks/main.yml | 12 ++--- .../setup_postgresql_db/tasks/main.yml | 54 +++++++++---------- .../setup_postgresql_db/vars/FreeBSD-11.yml | 2 +- .../setup_postgresql_db/vars/FreeBSD-12.0.yml | 2 +- .../setup_postgresql_db/vars/FreeBSD-12.1.yml | 2 +- .../setup_redis_replication/defaults/main.yml | 10 ++-- .../setup_redis_replication/handlers/main.yml | 2 +- .../setup_redis_replication/tasks/main.yml | 2 +- .../tasks/setup_redis_cluster.yml | 10 ++-- .../setup_remote_tmp_dir/tasks/main.yml | 4 +- .../tasks/main.yml | 4 +- .../targets/setup_rundeck/tasks/main.yml | 6 +-- .../targets/setup_snap/tasks/main.yml | 4 +- .../setup_wildfly_server/tasks/main.yml | 4 +- .../targets/shutdown/tasks/main.yml | 30 +++++------ .../targets/sudoers/tasks/main.yml | 10 ++-- .../targets/supervisorctl/tasks/main.yml | 20 +++---- .../supervisorctl/templates/supervisord.conf | 8 +-- .../integration/targets/sysrc/tasks/main.yml | 6 +-- .../targets/sysrc/tasks/setup-testjail.yml | 4 +- .../systemd_creds_decrypt/tasks/main.yaml | 4 +- .../systemd_creds_encrypt/tasks/main.yaml | 4 +- .../targets/systemd_info/tasks/main.yml | 18 +++---- .../targets/terraform/vars/main.yml | 4 +- .../test_fqdn_valid/tasks/fqdn_valid_1.yml | 6 --- .../targets/timezone/tasks/main.yml | 20 +++---- .../targets/timezone/tasks/test.yml | 38 ++++++------- tests/integration/targets/ufw/tasks/main.yml | 6 +-- .../targets/xfs_quota/tasks/main.yml | 2 +- tests/integration/targets/xml/tasks/main.yml | 8 +-- tests/integration/targets/yarn/tasks/main.yml | 4 +- tests/integration/targets/yarn/tasks/run.yml | 30 +++++------ .../targets/yum_versionlock/tasks/main.yml | 6 +-- .../integration/targets/zpool/tasks/main.yml | 2 +- .../integration/targets/zypper/tasks/main.yml | 2 +- .../targets/zypper/tasks/zypper.yml | 2 +- .../targets/zypper_repository/tasks/main.yml | 2 +- .../tasks/zypper_repository.yml | 22 ++++---- 144 files changed, 548 insertions(+), 578 deletions(-) diff --git a/tests/integration/targets/alternatives/tasks/main.yml b/tests/integration/targets/alternatives/tasks/main.yml index 906463903f..18522d380a 100644 --- a/tests/integration/targets/alternatives/tasks/main.yml +++ b/tests/integration/targets/alternatives/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/alternatives/tasks/setup.yml b/tests/integration/targets/alternatives/tasks/setup.yml index cadee7f7f2..bac39943f5 100644 --- a/tests/integration/targets/alternatives/tasks/setup.yml +++ b/tests/integration/targets/alternatives/tasks/setup.yml @@ -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: diff --git a/tests/integration/targets/alternatives/tasks/setup_test.yml b/tests/integration/targets/alternatives/tasks/setup_test.yml index 77279c67f1..1595ee7233 100644 --- a/tests/integration/targets/alternatives/tasks/setup_test.yml +++ b/tests/integration/targets/alternatives/tasks/setup_test.yml @@ -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' diff --git a/tests/integration/targets/alternatives/tasks/test.yml b/tests/integration/targets/alternatives/tasks/test.yml index 3445f64555..9efadb3485 100644 --- a/tests/integration/targets/alternatives/tasks/test.yml +++ b/tests/integration/targets/alternatives/tasks/test.yml @@ -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'" diff --git a/tests/integration/targets/alternatives/tasks/tests.yml b/tests/integration/targets/alternatives/tasks/tests.yml index 63068ede54..6819b55e8b 100644 --- a/tests/integration/targets/alternatives/tasks/tests.yml +++ b/tests/integration/targets/alternatives/tasks/tests.yml @@ -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] diff --git a/tests/integration/targets/android_sdk/tasks/main.yml b/tests/integration/targets/android_sdk/tasks/main.yml index 3b49df4056..683612fa0c 100644 --- a/tests/integration/targets/android_sdk/tasks/main.yml +++ b/tests/integration/targets/android_sdk/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/android_sdk/tasks/setup.yml b/tests/integration/targets/android_sdk/tasks/setup.yml index 9965403367..2580e1b71f 100644 --- a/tests/integration/targets/android_sdk/tasks/setup.yml +++ b/tests/integration/targets/android_sdk/tasks/setup.yml @@ -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: diff --git a/tests/integration/targets/apache2_mod_proxy/tasks/main.yml b/tests/integration/targets/apache2_mod_proxy/tasks/main.yml index a418d074db..d30afb1f51 100644 --- a/tests/integration/targets/apache2_mod_proxy/tasks/main.yml +++ b/tests/integration/targets/apache2_mod_proxy/tasks/main.yml @@ -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: | @@ -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: diff --git a/tests/integration/targets/apache2_module/tasks/actualtest.yml b/tests/integration/targets/apache2_module/tasks/actualtest.yml index 396c6d9097..629af4837e 100644 --- a/tests/integration/targets/apache2_module/tasks/actualtest.yml +++ b/tests/integration/targets/apache2_module/tasks/actualtest.yml @@ -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: diff --git a/tests/integration/targets/apache2_module/tasks/main.yml b/tests/integration/targets/apache2_module/tasks/main.yml index e8210f2682..46a02b31af 100644 --- a/tests/integration/targets/apache2_module/tasks/main.yml +++ b/tests/integration/targets/apache2_module/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/tests/integration/targets/apk/tasks/main.yml b/tests/integration/targets/apk/tasks/main.yml index 9410b259ab..c14dbc91fe 100644 --- a/tests/integration/targets/apk/tasks/main.yml +++ b/tests/integration/targets/apk/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/cargo/tasks/main.yml b/tests/integration/targets/cargo/tasks/main.yml index f28b459864..fd5d249a57 100644 --- a/tests/integration/targets/cargo/tasks/main.yml +++ b/tests/integration/targets/cargo/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/cargo/tasks/setup.yml b/tests/integration/targets/cargo/tasks/setup.yml index 6a98494106..09cfd60a41 100644 --- a/tests/integration/targets/cargo/tasks/setup.yml +++ b/tests/integration/targets/cargo/tasks/setup.yml @@ -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', '>=') diff --git a/tests/integration/targets/cloud_init_data_facts/tasks/main.yml b/tests/integration/targets/cloud_init_data_facts/tasks/main.yml index 79ce608e39..a3363f9f8e 100644 --- a/tests/integration/targets/cloud_init_data_facts/tasks/main.yml +++ b/tests/integration/targets/cloud_init_data_facts/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/cmd_runner/vars/main.yml b/tests/integration/targets/cmd_runner/vars/main.yml index 928add5946..6e61bc1ab2 100644 --- a/tests/integration/targets/cmd_runner/vars/main.yml +++ b/tests/integration/targets/cmd_runner/vars/main.yml @@ -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 }}" diff --git a/tests/integration/targets/consul/tasks/main.yml b/tests/integration/targets/consul/tasks/main.yml index 6ca51cb469..b88ef5b871 100644 --- a/tests/integration/targets/consul/tasks/main.yml +++ b/tests/integration/targets/consul/tasks/main.yml @@ -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 }}' diff --git a/tests/integration/targets/copr/tasks/main.yml b/tests/integration/targets/copr/tasks/main.yml index 4fc5ae5c08..0a6eaa47e7 100644 --- a/tests/integration/targets/copr/tasks/main.yml +++ b/tests/integration/targets/copr/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/copr/vars/main.yml b/tests/integration/targets/copr/vars/main.yml index a37a44d478..44a456167f 100644 --- a/tests/integration/targets/copr/vars/main.yml +++ b/tests/integration/targets/copr/vars/main.yml @@ -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 }}" diff --git a/tests/integration/targets/cpanm/tasks/main.yml b/tests/integration/targets/cpanm/tasks/main.yml index 89650154f2..68fe98ed82 100644 --- a/tests/integration/targets/cpanm/tasks/main.yml +++ b/tests/integration/targets/cpanm/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/decompress/tasks/main.yml b/tests/integration/targets/decompress/tasks/main.yml index f5900473ea..9d2c5adb45 100644 --- a/tests/integration/targets/decompress/tasks/main.yml +++ b/tests/integration/targets/decompress/tasks/main.yml @@ -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: | diff --git a/tests/integration/targets/discord/tasks/main.yml b/tests/integration/targets/discord/tasks/main.yml index 29314ba238..0172701693 100644 --- a/tests/integration/targets/discord/tasks/main.yml +++ b/tests/integration/targets/discord/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/dnf_versionlock/tasks/main.yml b/tests/integration/targets/dnf_versionlock/tasks/main.yml index 51e823ffd7..bf8c044328 100644 --- a/tests/integration/targets/dnf_versionlock/tasks/main.yml +++ b/tests/integration/targets/dnf_versionlock/tasks/main.yml @@ -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', '>=')) ... diff --git a/tests/integration/targets/dpkg_divert/tasks/main.yml b/tests/integration/targets/dpkg_divert/tasks/main.yml index 910f174e17..94503c9f0d 100644 --- a/tests/integration/targets/dpkg_divert/tasks/main.yml +++ b/tests/integration/targets/dpkg_divert/tasks/main.yml @@ -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" diff --git a/tests/integration/targets/ejabberd_user/tasks/main.yml b/tests/integration/targets/ejabberd_user/tasks/main.yml index 0e6e2da582..51e0630e05 100644 --- a/tests/integration/targets/ejabberd_user/tasks/main.yml +++ b/tests/integration/targets/ejabberd_user/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/etcd3/tasks/main.yml b/tests/integration/targets/etcd3/tasks/main.yml index 2fe7435dc9..376a53ef85 100644 --- a/tests/integration/targets/etcd3/tasks/main.yml +++ b/tests/integration/targets/etcd3/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/filesize/tasks/main.yml b/tests/integration/targets/filesize/tasks/main.yml index 68cd8934cf..71dd62550b 100644 --- a/tests/integration/targets/filesize/tasks/main.yml +++ b/tests/integration/targets/filesize/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/filesystem/tasks/create_fs.yml b/tests/integration/targets/filesystem/tasks/create_fs.yml index d5470fa56b..8dcc6ee170 100644 --- a/tests/integration/targets/filesystem/tasks/create_fs.yml +++ b/tests/integration/targets/filesystem/tasks/create_fs.yml @@ -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: diff --git a/tests/integration/targets/filesystem/tasks/main.yml b/tests/integration/targets/filesystem/tasks/main.yml index b2ae94afa5..94504d9185 100644 --- a/tests/integration/targets/filesystem/tasks/main.yml +++ b/tests/integration/targets/filesystem/tasks/main.yml @@ -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 }}" diff --git a/tests/integration/targets/filesystem/tasks/reset_fs_uuid.yml b/tests/integration/targets/filesystem/tasks/reset_fs_uuid.yml index bd9aa607c4..dc29b5e4f1 100644 --- a/tests/integration/targets/filesystem/tasks/reset_fs_uuid.yml +++ b/tests/integration/targets/filesystem/tasks/reset_fs_uuid.yml @@ -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 diff --git a/tests/integration/targets/filesystem/tasks/set_fs_uuid_on_creation.yml b/tests/integration/targets/filesystem/tasks/set_fs_uuid_on_creation.yml index 9ec45e9e5c..d61051dab3 100644 --- a/tests/integration/targets/filesystem/tasks/set_fs_uuid_on_creation.yml +++ b/tests/integration/targets/filesystem/tasks/set_fs_uuid_on_creation.yml @@ -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: diff --git a/tests/integration/targets/filesystem/tasks/setup.yml b/tests/integration/targets/filesystem/tasks/setup.yml index 12d86d1ba9..19620cd179 100644 --- a/tests/integration/targets/filesystem/tasks/setup.yml +++ b/tests/integration/targets/filesystem/tasks/setup.yml @@ -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: diff --git a/tests/integration/targets/filter_keep_keys/tasks/tests.yml b/tests/integration/targets/filter_keep_keys/tasks/tests.yml index bebfc5fcbf..3767a6e801 100644 --- a/tests/integration/targets/filter_keep_keys/tasks/tests.yml +++ b/tests/integration/targets/filter_keep_keys/tasks/tests.yml @@ -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: diff --git a/tests/integration/targets/filter_lists_mergeby/tasks/lists_mergeby_default.yml b/tests/integration/targets/filter_lists_mergeby/tasks/lists_mergeby_default.yml index b0484af2f2..b2a18597a5 100644 --- a/tests/integration/targets/filter_lists_mergeby/tasks/lists_mergeby_default.yml +++ b/tests/integration/targets/filter_lists_mergeby/tasks/lists_mergeby_default.yml @@ -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 diff --git a/tests/integration/targets/filter_remove_keys/tasks/tests.yml b/tests/integration/targets/filter_remove_keys/tasks/tests.yml index bebfc5fcbf..3767a6e801 100644 --- a/tests/integration/targets/filter_remove_keys/tasks/tests.yml +++ b/tests/integration/targets/filter_remove_keys/tasks/tests.yml @@ -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: diff --git a/tests/integration/targets/filter_replace_keys/tasks/tests.yml b/tests/integration/targets/filter_replace_keys/tasks/tests.yml index bebfc5fcbf..3767a6e801 100644 --- a/tests/integration/targets/filter_replace_keys/tasks/tests.yml +++ b/tests/integration/targets/filter_replace_keys/tasks/tests.yml @@ -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: diff --git a/tests/integration/targets/flatpak/tasks/main.yml b/tests/integration/targets/flatpak/tasks/main.yml index e05e2a168e..9946aafdc9 100644 --- a/tests/integration/targets/flatpak/tasks/main.yml +++ b/tests/integration/targets/flatpak/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/flatpak/tasks/setup.yml b/tests/integration/targets/flatpak/tasks/setup.yml index 041c736624..8de3e32250 100644 --- a/tests/integration/targets/flatpak/tasks/setup.yml +++ b/tests/integration/targets/flatpak/tasks/setup.yml @@ -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 diff --git a/tests/integration/targets/flatpak_remote/tasks/main.yml b/tests/integration/targets/flatpak_remote/tasks/main.yml index 951ab5aefb..3426997d4b 100644 --- a/tests/integration/targets/flatpak_remote/tasks/main.yml +++ b/tests/integration/targets/flatpak_remote/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/flatpak_remote/tasks/setup.yml b/tests/integration/targets/flatpak_remote/tasks/setup.yml index 9fbf4cbe15..ae883060ab 100644 --- a/tests/integration/targets/flatpak_remote/tasks/setup.yml +++ b/tests/integration/targets/flatpak_remote/tasks/setup.yml @@ -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 diff --git a/tests/integration/targets/gem/tasks/main.yml b/tests/integration/targets/gem/tasks/main.yml index 73119c20da..2f1363ee85 100644 --- a/tests/integration/targets/gem/tasks/main.yml +++ b/tests/integration/targets/gem/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/homebrew/tasks/main.yml b/tests/integration/targets/homebrew/tasks/main.yml index 31e6dc80eb..c9fded186d 100644 --- a/tests/integration/targets/homebrew/tasks/main.yml +++ b/tests/integration/targets/homebrew/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/homebrew_cask/tasks/main.yml b/tests/integration/targets/homebrew_cask/tasks/main.yml index d68edb6d35..0c826da064 100644 --- a/tests/integration/targets/homebrew_cask/tasks/main.yml +++ b/tests/integration/targets/homebrew_cask/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/homectl/tasks/main.yml b/tests/integration/targets/homectl/tasks/main.yml index aa924293e3..1bbeadfaa5 100644 --- a/tests/integration/targets/homectl/tasks/main.yml +++ b/tests/integration/targets/homectl/tasks/main.yml @@ -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! diff --git a/tests/integration/targets/influxdb_user/tasks/main.yml b/tests/integration/targets/influxdb_user/tasks/main.yml index 7da2f85e5f..d978d54e74 100644 --- a/tests/integration/targets/influxdb_user/tasks/main.yml +++ b/tests/integration/targets/influxdb_user/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/ipify_facts/tasks/main.yml b/tests/integration/targets/ipify_facts/tasks/main.yml index 78e44e9462..d445de9746 100644 --- a/tests/integration/targets/ipify_facts/tasks/main.yml +++ b/tests/integration/targets/ipify_facts/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/iso_customize/tasks/iso_customize.yml b/tests/integration/targets/iso_customize/tasks/iso_customize.yml index 30c6f31c16..e08dd52032 100644 --- a/tests/integration/targets/iso_customize/tasks/iso_customize.yml +++ b/tests/integration/targets/iso_customize/tasks/iso_customize.yml @@ -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" diff --git a/tests/integration/targets/iso_customize/tasks/iso_customize_delete_files.yml b/tests/integration/targets/iso_customize/tasks/iso_customize_delete_files.yml index d8660062a2..2cc71918ab 100644 --- a/tests/integration/targets/iso_customize/tasks/iso_customize_delete_files.yml +++ b/tests/integration/targets/iso_customize/tasks/iso_customize_delete_files.yml @@ -10,7 +10,7 @@ delete_files: - "test01.cfg" -- debug: var=ansible_distribution +- debug: var=ansible_facts.distribution - include_tasks: iso_mount.yml vars: diff --git a/tests/integration/targets/iso_customize/tasks/iso_mount.yml b/tests/integration/targets/iso_customize/tasks/iso_mount.yml index 22d99458e4..6e4c418d31 100644 --- a/tests/integration/targets/iso_customize/tasks/iso_mount.yml +++ b/tests/integration/targets/iso_customize/tasks/iso_mount.yml @@ -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" diff --git a/tests/integration/targets/iso_customize/tasks/main.yml b/tests/integration/targets/iso_customize/tasks/main.yml index 6628bcc470..86fe5585e6 100644 --- a/tests/integration/targets/iso_customize/tasks/main.yml +++ b/tests/integration/targets/iso_customize/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/iso_extract/tasks/7zip.yml b/tests/integration/targets/iso_extract/tasks/7zip.yml index e0f1586ce1..1d23f79187 100644 --- a/tests/integration/targets/iso_extract/tasks/7zip.yml +++ b/tests/integration/targets/iso_extract/tasks/7zip.yml @@ -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: diff --git a/tests/integration/targets/iso_extract/tasks/main.yml b/tests/integration/targets/iso_extract/tasks/main.yml index bb87f680f1..fd4dd56cde 100644 --- a/tests/integration/targets/iso_extract/tasks/main.yml +++ b/tests/integration/targets/iso_extract/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/java_cert/tasks/state_change.yml b/tests/integration/targets/java_cert/tasks/state_change.yml index fe4d87f0b8..bc2fa33a0f 100644 --- a/tests/integration/targets/java_cert/tasks/state_change.yml +++ b/tests/integration/targets/java_cert/tasks/state_change.yml @@ -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 diff --git a/tests/integration/targets/launchd/tasks/main.yml b/tests/integration/targets/launchd/tasks/main.yml index 8f5b14a596..6a8095136e 100644 --- a/tests/integration/targets/launchd/tasks/main.yml +++ b/tests/integration/targets/launchd/tasks/main.yml @@ -27,4 +27,4 @@ - test_reload - test_runatload - when: ansible_os_family == 'Darwin' + when: ansible_facts.os_family == 'Darwin' diff --git a/tests/integration/targets/ldap_inc/tasks/main.yml b/tests/integration/targets/ldap_inc/tasks/main.yml index 521075b5e1..946677516c 100644 --- a/tests/integration/targets/ldap_inc/tasks/main.yml +++ b/tests/integration/targets/ldap_inc/tasks/main.yml @@ -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'] diff --git a/tests/integration/targets/ldap_search/tasks/main.yml b/tests/integration/targets/ldap_search/tasks/main.yml index 521075b5e1..946677516c 100644 --- a/tests/integration/targets/ldap_search/tasks/main.yml +++ b/tests/integration/targets/ldap_search/tasks/main.yml @@ -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'] diff --git a/tests/integration/targets/listen_ports_facts/tasks/main.yml b/tests/integration/targets/listen_ports_facts/tasks/main.yml index 5da5b03784..9bc881cc1f 100644 --- a/tests/integration/targets/listen_ports_facts/tasks/main.yml +++ b/tests/integration/targets/listen_ports_facts/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/locale_gen/tasks/11046-usrlocal.yml b/tests/integration/targets/locale_gen/tasks/11046-usrlocal.yml index bcdad4c548..c746aee82c 100644 --- a/tests/integration/targets/locale_gen/tasks/11046-usrlocal.yml +++ b/tests/integration/targets/locale_gen/tasks/11046-usrlocal.yml @@ -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 diff --git a/tests/integration/targets/locale_gen/tasks/main.yml b/tests/integration/targets/locale_gen/tasks/main.yml index 76528af2ec..3faef76bd6 100644 --- a/tests/integration/targets/locale_gen/tasks/main.yml +++ b/tests/integration/targets/locale_gen/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/lookup_lmdb_kv/dependencies.yml b/tests/integration/targets/lookup_lmdb_kv/dependencies.yml index 9fc63b19fa..286ef753c3 100644 --- a/tests/integration/targets/lookup_lmdb_kv/dependencies.yml +++ b/tests/integration/targets/lookup_lmdb_kv/dependencies.yml @@ -13,4 +13,4 @@ - name: Setup test data script: test_db.py args: - executable: "{{ ansible_python.executable }}" + executable: "{{ ansible_facts.python.executable }}" diff --git a/tests/integration/targets/lookup_passwordstore/templates/security-privacy.repo.j2 b/tests/integration/targets/lookup_passwordstore/templates/security-privacy.repo.j2 index 72eca99ec9..8f73ea4898 100644 --- a/tests/integration/targets/lookup_passwordstore/templates/security-privacy.repo.j2 +++ b/tests/integration/targets/lookup_passwordstore/templates/security-privacy.repo.j2 @@ -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 diff --git a/tests/integration/targets/lvg/tasks/main.yml b/tests/integration/targets/lvg/tasks/main.yml index 6bc6944f5f..32365b37fd 100644 --- a/tests/integration/targets/lvg/tasks/main.yml +++ b/tests/integration/targets/lvg/tasks/main.yml @@ -12,7 +12,7 @@ package: name: lvm2 state: present - when: ansible_system == 'Linux' + when: ansible_facts.system == 'Linux' - name: Test lvg module block: diff --git a/tests/integration/targets/lvg/tasks/test_grow_reduce.yml b/tests/integration/targets/lvg/tasks/test_grow_reduce.yml index 857df92464..1cb3467c32 100644 --- a/tests/integration/targets/lvg/tasks/test_grow_reduce.yml +++ b/tests/integration/targets/lvg/tasks/test_grow_reduce.yml @@ -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" diff --git a/tests/integration/targets/lvg/tasks/test_remove_extra_pvs.yml b/tests/integration/targets/lvg/tasks/test_remove_extra_pvs.yml index 830986d8da..674105c23e 100644 --- a/tests/integration/targets/lvg/tasks/test_remove_extra_pvs.yml +++ b/tests/integration/targets/lvg/tasks/test_remove_extra_pvs.yml @@ -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" diff --git a/tests/integration/targets/lvg_rename/tasks/main.yml b/tests/integration/targets/lvg_rename/tasks/main.yml index 18dd6f1baf..508b8f1495 100644 --- a/tests/integration/targets/lvg_rename/tasks/main.yml +++ b/tests/integration/targets/lvg_rename/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/lvm_pv/tasks/main.yml b/tests/integration/targets/lvm_pv/tasks/main.yml index 16c966d274..b5d023199d 100644 --- a/tests/integration/targets/lvm_pv/tasks/main.yml +++ b/tests/integration/targets/lvm_pv/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/lvm_pv_move_data/tasks/main.yml b/tests/integration/targets/lvm_pv_move_data/tasks/main.yml index 908e1b9a99..0ee8337ff7 100644 --- a/tests/integration/targets/lvm_pv_move_data/tasks/main.yml +++ b/tests/integration/targets/lvm_pv_move_data/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/lvol/tasks/main.yml b/tests/integration/targets/lvol/tasks/main.yml index 0e3bfa1a31..c3360b8fbf 100644 --- a/tests/integration/targets/lvol/tasks/main.yml +++ b/tests/integration/targets/lvol/tasks/main.yml @@ -12,7 +12,7 @@ package: name: lvm2 state: present - when: ansible_system == 'Linux' + when: ansible_facts.system == 'Linux' - name: Test lvol module block: diff --git a/tests/integration/targets/mail/tasks/main.yml b/tests/integration/targets/mail/tasks/main.yml index 3831a43643..48d33ffd18 100644 --- a/tests/integration/targets/mail/tasks/main.yml +++ b/tests/integration/targets/mail/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/monit/tasks/main.yml b/tests/integration/targets/monit/tasks/main.yml index 518e997c32..aba17646a0 100644 --- a/tests/integration/targets/monit/tasks/main.yml +++ b/tests/integration/targets/monit/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/mqtt/tasks/main.yml b/tests/integration/targets/mqtt/tasks/main.yml index 33f9307c5f..ab3c0227f9 100644 --- a/tests/integration/targets/mqtt/tasks/main.yml +++ b/tests/integration/targets/mqtt/tasks/main.yml @@ -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'] diff --git a/tests/integration/targets/nomad/tasks/main.yml b/tests/integration/targets/nomad/tasks/main.yml index 87b1c0474e..581c154550 100644 --- a/tests/integration/targets/nomad/tasks/main.yml +++ b/tests/integration/targets/nomad/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/npm/tasks/main.yml b/tests/integration/targets/npm/tasks/main.yml index 686bd3e434..47fdfe875b 100644 --- a/tests/integration/targets/npm/tasks/main.yml +++ b/tests/integration/targets/npm/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/npm/tasks/no_bin_links.yml b/tests/integration/targets/npm/tasks/no_bin_links.yml index 3588f76429..16b5f48017 100644 --- a/tests/integration/targets/npm/tasks/no_bin_links.yml +++ b/tests/integration/targets/npm/tasks/no_bin_links.yml @@ -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' diff --git a/tests/integration/targets/npm/tasks/test.yml b/tests/integration/targets/npm/tasks/test.yml index 0ab8a98d22..e237531a36 100644 --- a/tests/integration/targets/npm/tasks/test.yml +++ b/tests/integration/targets/npm/tasks/test.yml @@ -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 diff --git a/tests/integration/targets/odbc/tasks/install_pyodbc.yml b/tests/integration/targets/odbc/tasks/install_pyodbc.yml index e0cefe14d3..b3b518bb2d 100644 --- a/tests/integration/targets/odbc/tasks/install_pyodbc.yml +++ b/tests/integration/targets/odbc/tasks/install_pyodbc.yml @@ -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: diff --git a/tests/integration/targets/odbc/tasks/main.yml b/tests/integration/targets/odbc/tasks/main.yml index 8e6e047693..e60198d779 100644 --- a/tests/integration/targets/odbc/tasks/main.yml +++ b/tests/integration/targets/odbc/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/pacman/tasks/main.yml b/tests/integration/targets/pacman/tasks/main.yml index 1f6001a669..af0c2c1a18 100644 --- a/tests/integration/targets/pacman/tasks/main.yml +++ b/tests/integration/targets/pacman/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/parted/tasks/main.yml b/tests/integration/targets/parted/tasks/main.yml index c91258d35d..dbd916486e 100644 --- a/tests/integration/targets/parted/tasks/main.yml +++ b/tests/integration/targets/parted/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/pipx/tasks/main.yml b/tests/integration/targets/pipx/tasks/main.yml index 26ad31ba0f..1d217788aa 100644 --- a/tests/integration/targets/pipx/tasks/main.yml +++ b/tests/integration/targets/pipx/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/pipx/tasks/testcase-8793-global.yml b/tests/integration/targets/pipx/tasks/testcase-8793-global.yml index b9bf8b75f6..265f657fe1 100644 --- a/tests/integration/targets/pipx/tasks/testcase-8793-global.yml +++ b/tests/integration/targets/pipx/tasks/testcase-8793-global.yml @@ -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: diff --git a/tests/integration/targets/pipx/tasks/testcase-8809-installall.yml b/tests/integration/targets/pipx/tasks/testcase-8809-installall.yml index 9e770c1a98..f0b5343758 100644 --- a/tests/integration/targets/pipx/tasks/testcase-8809-installall.yml +++ b/tests/integration/targets/pipx/tasks/testcase-8809-installall.yml @@ -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: diff --git a/tests/integration/targets/pipx/tasks/testcase-8809-pin.yml b/tests/integration/targets/pipx/tasks/testcase-8809-pin.yml index abc71a5719..3e3c559100 100644 --- a/tests/integration/targets/pipx/tasks/testcase-8809-pin.yml +++ b/tests/integration/targets/pipx/tasks/testcase-8809-pin.yml @@ -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: diff --git a/tests/integration/targets/pipx/tasks/testcase-8809-uninjectpkg.yml b/tests/integration/targets/pipx/tasks/testcase-8809-uninjectpkg.yml index b319b54d93..a193b69f1d 100644 --- a/tests/integration/targets/pipx/tasks/testcase-8809-uninjectpkg.yml +++ b/tests/integration/targets/pipx/tasks/testcase-8809-uninjectpkg.yml @@ -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: diff --git a/tests/integration/targets/pipx_info/tasks/main.yml b/tests/integration/targets/pipx_info/tasks/main.yml index d51ce1b33e..8dec154e6b 100644 --- a/tests/integration/targets/pipx_info/tasks/main.yml +++ b/tests/integration/targets/pipx_info/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/pkgng/tasks/freebsd.yml b/tests/integration/targets/pkgng/tasks/freebsd.yml index b51ad836bd..ef389ab575 100644 --- a/tests/integration/targets/pkgng/tasks/freebsd.yml +++ b/tests/integration/targets/pkgng/tasks/freebsd.yml @@ -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 diff --git a/tests/integration/targets/pkgng/tasks/setup-testjail.yml b/tests/integration/targets/pkgng/tasks/setup-testjail.yml index 3055d29e88..943f462353 100644 --- a/tests/integration/targets/pkgng/tasks/setup-testjail.yml +++ b/tests/integration/targets/pkgng/tasks/setup-testjail.yml @@ -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 diff --git a/tests/integration/targets/pnpm/tasks/main.yml b/tests/integration/targets/pnpm/tasks/main.yml index 10f42618f7..6d8329c259 100644 --- a/tests/integration/targets/pnpm/tasks/main.yml +++ b/tests/integration/targets/pnpm/tasks/main.yml @@ -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') diff --git a/tests/integration/targets/pnpm/tasks/run.yml b/tests/integration/targets/pnpm/tasks/run.yml index 66f5eb622b..70b73934cb 100644 --- a/tests/integration/targets/pnpm/tasks/run.yml +++ b/tests/integration/targets/pnpm/tasks/run.yml @@ -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 diff --git a/tests/integration/targets/python_requirements_info/tasks/main.yml b/tests/integration/targets/python_requirements_info/tasks/main.yml index cf0b9ad1d0..c30fc17096 100644 --- a/tests/integration/targets/python_requirements_info/tasks/main.yml +++ b/tests/integration/targets/python_requirements_info/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/sefcontext/tasks/main.yml b/tests/integration/targets/sefcontext/tasks/main.yml index 04143d1cbc..2bf32d8498 100644 --- a/tests/integration/targets/sefcontext/tasks/main.yml +++ b/tests/integration/targets/sefcontext/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/sefcontext/tasks/sefcontext.yml b/tests/integration/targets/sefcontext/tasks/sefcontext.yml index ae815a22f8..efd4b1b883 100644 --- a/tests/integration/targets/sefcontext/tasks/sefcontext.yml +++ b/tests/integration/targets/sefcontext/tasks/sefcontext.yml @@ -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: diff --git a/tests/integration/targets/setup_apache2/tasks/main.yml b/tests/integration/targets/setup_apache2/tasks/main.yml index 58651d2ce8..d531ea6980 100644 --- a/tests/integration/targets/setup_apache2/tasks/main.yml +++ b/tests/integration/targets/setup_apache2/tasks/main.yml @@ -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'" diff --git a/tests/integration/targets/setup_cron/tasks/main.yml b/tests/integration/targets/setup_cron/tasks/main.yml index 92d2893403..eb35e6cb25 100644 --- a/tests/integration/targets/setup_cron/tasks/main.yml +++ b/tests/integration/targets/setup_cron/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/setup_docker/tasks/main.yml b/tests/integration/targets/setup_docker/tasks/main.yml index 0c1b86951a..efbf2b5ca8 100644 --- a/tests/integration/targets/setup_docker/tasks/main.yml +++ b/tests/integration/targets/setup_docker/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/setup_epel/tasks/main.yml b/tests/integration/targets/setup_epel/tasks/main.yml index 186d515f41..68b85a5fd6 100644 --- a/tests/integration/targets/setup_epel/tasks/main.yml +++ b/tests/integration/targets/setup_epel/tasks/main.yml @@ -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'] diff --git a/tests/integration/targets/setup_etcd3/tasks/main.yml b/tests/integration/targets/setup_etcd3/tasks/main.yml index 3510a291f7..04ff877130 100644 --- a/tests/integration/targets/setup_etcd3/tasks/main.yml +++ b/tests/integration/targets/setup_etcd3/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/setup_flatpak_remote/tasks/main.yaml b/tests/integration/targets/setup_flatpak_remote/tasks/main.yaml index e63cb379a0..b3cfd36deb 100644 --- a/tests/integration/targets/setup_flatpak_remote/tasks/main.yaml +++ b/tests/integration/targets/setup_flatpak_remote/tasks/main.yaml @@ -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: diff --git a/tests/integration/targets/setup_influxdb/tasks/main.yml b/tests/integration/targets/setup_influxdb/tasks/main.yml index bc64ab319d..f7c4c94b2a 100644 --- a/tests/integration/targets/setup_influxdb/tasks/main.yml +++ b/tests/integration/targets/setup_influxdb/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/setup_java_keytool/tasks/main.yml b/tests/integration/targets/setup_java_keytool/tasks/main.yml index 56ba7a9581..42f71c2b30 100644 --- a/tests/integration/targets/setup_java_keytool/tasks/main.yml +++ b/tests/integration/targets/setup_java_keytool/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/setup_mosquitto/tasks/main.yml b/tests/integration/targets/setup_mosquitto/tasks/main.yml index 2dd0674dc2..ee75b6fcdb 100644 --- a/tests/integration/targets/setup_mosquitto/tasks/main.yml +++ b/tests/integration/targets/setup_mosquitto/tasks/main.yml @@ -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' diff --git a/tests/integration/targets/setup_openldap/tasks/main.yml b/tests/integration/targets/setup_openldap/tasks/main.yml index 54d51f0fea..337033eb1b 100644 --- a/tests/integration/targets/setup_openldap/tasks/main.yml +++ b/tests/integration/targets/setup_openldap/tasks/main.yml @@ -11,7 +11,7 @@ - name: Setup OpenLDAP on Debian or Ubuntu block: - name: Include OS-specific variables - include_vars: '{{ ansible_os_family }}.yml' + include_vars: '{{ ansible_facts.os_family }}.yml' - name: Install OpenLDAP server and tools become: true @@ -89,4 +89,4 @@ - initial_config.ldif - ldap_inc_config.ldif - when: ansible_os_family in ['Ubuntu', 'Debian'] + when: ansible_facts.os_family in ['Ubuntu', 'Debian'] diff --git a/tests/integration/targets/setup_openssl/tasks/main.yml b/tests/integration/targets/setup_openssl/tasks/main.yml index 667dfa699f..772b6784a6 100644 --- a/tests/integration/targets/setup_openssl/tasks/main.yml +++ b/tests/integration/targets/setup_openssl/tasks/main.yml @@ -13,10 +13,10 @@ vars: search: 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 @@ -25,7 +25,7 @@ become: true package: name: '{{ openssl_package_name }}' - when: not ansible_os_family == 'Darwin' + when: not ansible_facts.os_family == 'Darwin' - when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6'] block: @@ -53,5 +53,5 @@ register: openssl_version - name: register cryptography version - command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'" + command: "{{ ansible_facts.python.executable }} -c 'import cryptography; print(cryptography.__version__)'" register: cryptography_version diff --git a/tests/integration/targets/setup_openssl/vars/CentOS-8.yml b/tests/integration/targets/setup_openssl/vars/CentOS-8.yml index 875a697183..369f25809e 100644 --- a/tests/integration/targets/setup_openssl/vars/CentOS-8.yml +++ b/tests/integration/targets/setup_openssl/vars/CentOS-8.yml @@ -6,4 +6,4 @@ cryptography_package_name: python-cryptography cryptography_package_name_python3: python3-cryptography openssl_package_name: openssl -cryptography_from_pip: '{{ ansible_python_version is version("3.8", ">=") }}' +cryptography_from_pip: '{{ ansible_facts.python_version is version("3.8", ">=") }}' diff --git a/tests/integration/targets/setup_openssl/vars/FreeBSD.yml b/tests/integration/targets/setup_openssl/vars/FreeBSD.yml index e5ad6812f0..19a10cc145 100644 --- a/tests/integration/targets/setup_openssl/vars/FreeBSD.yml +++ b/tests/integration/targets/setup_openssl/vars/FreeBSD.yml @@ -4,8 +4,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later cryptography_package_name: py27-cryptography -cryptography_package_name_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-cryptography" +cryptography_package_name_python3: "py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-cryptography" pyopenssl_package_name: py27-openssl -pyopenssl_package_name_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-openssl" +pyopenssl_package_name_python3: "py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-openssl" openssl_package_name: openssl cryptography_from_pip: false diff --git a/tests/integration/targets/setup_paramiko/tasks/main.yml b/tests/integration/targets/setup_paramiko/tasks/main.yml index dc0be1be35..cab5aa7b4a 100644 --- a/tests/integration/targets/setup_paramiko/tasks/main.yml +++ b/tests/integration/targets/setup_paramiko/tasks/main.yml @@ -14,10 +14,10 @@ - paramiko state: present extra_args: "-c {{ remote_constraints }}" - 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: Install required libs (Debian 13+) package: name: python3-paramiko state: present - when: ansible_distribution == 'Debian' and ansible_distribution_major_version is version('13', '>=') + when: ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version is version('13', '>=') diff --git a/tests/integration/targets/setup_pkg_mgr/tasks/archlinux.yml b/tests/integration/targets/setup_pkg_mgr/tasks/archlinux.yml index f471cc19a4..f021e3ff9a 100644 --- a/tests/integration/targets/setup_pkg_mgr/tasks/archlinux.yml +++ b/tests/integration/targets/setup_pkg_mgr/tasks/archlinux.yml @@ -24,5 +24,5 @@ - name: Remove EXTERNALLY-MANAGED file file: - path: /usr/lib/python{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}/EXTERNALLY-MANAGED + path: /usr/lib/python{{ ansible_facts.python.version.major }}.{{ ansible_facts.python.version.minor }}/EXTERNALLY-MANAGED state: absent diff --git a/tests/integration/targets/setup_pkg_mgr/tasks/main.yml b/tests/integration/targets/setup_pkg_mgr/tasks/main.yml index 91f406d861..cb65164097 100644 --- a/tests/integration/targets/setup_pkg_mgr/tasks/main.yml +++ b/tests/integration/targets/setup_pkg_mgr/tasks/main.yml @@ -12,34 +12,34 @@ pkg_mgr: community.general.pkgng ansible_pkg_mgr: community.general.pkgng cacheable: true - when: ansible_os_family == "FreeBSD" + when: ansible_facts.os_family == "FreeBSD" - set_fact: pkg_mgr: community.general.zypper ansible_pkg_mgr: community.general.zypper cacheable: true - when: ansible_os_family == "Suse" + when: ansible_facts.os_family == "Suse" - set_fact: pkg_mgr: community.general.pacman ansible_pkg_mgr: community.general.pacman cacheable: true - when: ansible_os_family == "Archlinux" + when: ansible_facts.os_family == "Archlinux" - shell: cmd: | sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo sed -i 's%#baseurl=http://mirror.centos.org/%baseurl=https://vault.centos.org/%g' /etc/yum.repos.d/*.repo - when: ansible_distribution in 'CentOS' and ansible_distribution_major_version == '7' + when: ansible_facts.distribution in 'CentOS' and ansible_facts.distribution_major_version == '7' - shell: cmd: | sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*.repo sed -i 's%#baseurl=http://mirror.centos.org/$contentdir/$releasever/%baseurl=https://vault.centos.org/8.4.2105/%g' /etc/yum.repos.d/CentOS-Linux-*.repo ignore_errors: true # This fails for CentOS Stream 8 - when: ansible_distribution in 'CentOS' and ansible_distribution_major_version == '8' + when: ansible_facts.distribution in 'CentOS' and ansible_facts.distribution_major_version == '8' -- when: ansible_os_family == "Archlinux" +- when: ansible_facts.os_family == "Archlinux" block: - name: ArchLinux specific setup include_tasks: archlinux.yml diff --git a/tests/integration/targets/setup_postgresql_db/tasks/main.yml b/tests/integration/targets/setup_postgresql_db/tasks/main.yml index 295718fc18..a3a889a4be 100644 --- a/tests/integration/targets/setup_postgresql_db/tasks/main.yml +++ b/tests/integration/targets/setup_postgresql_db/tasks/main.yml @@ -10,7 +10,7 @@ # Exit when Suse because it causes CI problems - meta: end_play - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' # To avoid hangings on service start/stop postgres during CI runs: - meta: end_play @@ -25,9 +25,9 @@ vars: params: files: - - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' - - '{{ ansible_distribution }}-{{ ansible_distribution_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 }}.yml' - default.yml paths: - '{{ role_path }}/vars' @@ -36,7 +36,7 @@ systemd: name: dbus state: started - when: ansible_service_mgr == 'systemd' and ansible_distribution == 'Fedora' + when: ansible_facts.service_mgr == 'systemd' and ansible_facts.distribution == 'Fedora' - name: Kill all postgres processes shell: 'pkill -u {{ pg_user }}' @@ -53,21 +53,21 @@ path: '{{ pg_dir }}' state: absent ignore_errors: true - when: ansible_os_family == "RedHat" or ansible_os_family == "Suse" + when: ansible_facts.os_family == "RedHat" or ansible_facts.os_family == "Suse" - name: remove old db (FreeBSD) file: path: '{{ pg_dir }}' state: absent ignore_errors: true - when: ansible_os_family == "FreeBSD" + when: ansible_facts.os_family == "FreeBSD" - name: remove old db config and files (debian) file: path: '{{ loop_item }}' state: absent ignore_errors: true - when: ansible_os_family == "Debian" + when: ansible_facts.os_family == "Debian" loop: - /etc/postgresql - /var/lib/postgresql @@ -84,38 +84,38 @@ - name: initialize postgres (FreeBSD) command: /usr/local/etc/rc.d/postgresql oneinitdb - when: ansible_os_family == "FreeBSD" + when: ansible_facts.os_family == "FreeBSD" - name: Initialize postgres (RedHat systemd) command: postgresql-setup initdb - when: ansible_os_family == "RedHat" and ansible_service_mgr == "systemd" + when: ansible_facts.os_family == "RedHat" and ansible_facts.service_mgr == "systemd" - name: Initialize postgres (RedHat sysv) command: /sbin/service postgresql initdb - when: ansible_os_family == "RedHat" and ansible_service_mgr != "systemd" + when: ansible_facts.os_family == "RedHat" and ansible_facts.service_mgr != "systemd" - name: Initialize postgres (Archlinux) command: su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'" - when: ansible_os_family == "Archlinux" + when: ansible_facts.os_family == "Archlinux" - name: Initialize postgres (Alpine) command: su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgresql/data'" - when: ansible_os_family == "Alpine" + when: ansible_facts.os_family == "Alpine" - name: Initialize postgres (Debian) shell: . /usr/share/postgresql-common/maintscripts-functions && set_system_locale && /usr/bin/pg_createcluster -u postgres {{ pg_ver }} main args: creates: /etc/postgresql/{{ pg_ver }}/ - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: Initialize postgres (Suse) service: name=postgresql state=stopped - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' - name: Pause between stop and start postgresql pause: seconds: 5 - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' - name: Make installable on Arch community.general.ini_file: @@ -136,16 +136,16 @@ - RestrictNamespaces - RestrictRealtime - SystemCallArchitectures - 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' - name: Initialize postgres (Suse) service: name=postgresql state=started - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' - name: Copy pg_hba into place template: @@ -162,7 +162,7 @@ with_items: - pt_BR - es_ES - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - block: - name: Install langpacks (RHEL8) @@ -172,7 +172,7 @@ - glibc-langpack-pt - glibc-all-langpacks state: present - when: ansible_distribution_major_version is version('8', '>=') + when: ansible_facts.distribution_major_version is version('8', '>=') - name: Check if locales need to be generated (RedHat) shell: localedef --list-archive | grep -a -q '^{{ locale }}$' @@ -192,7 +192,7 @@ command: localedef -f ISO-8859-1 -i {{ item.locale }} {{ item.locale }} when: item is failed with_items: '{{ locale_present.results }}' - when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' + when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution != 'Fedora' - name: Install glibc langpacks (Fedora >= 24) package: @@ -201,13 +201,13 @@ with_items: - glibc-langpack-es - glibc-langpack-pt - when: ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('24', '>=') + when: ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version is version('24', '>=') - name: enable postgresql service (FreeBSD) lineinfile: path: /etc/rc.conf line: postgresql_enable="YES" - when: ansible_os_family == "FreeBSD" + when: ansible_facts.os_family == "FreeBSD" - name: start postgresql service service: name={{ postgresql_service }} state=started @@ -239,7 +239,7 @@ src: dummy.control dest: /usr/share/postgresql/{{ pg_ver }}/extension/dummy.control mode: '0444' - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: copy version files for dummy ext copy: @@ -250,7 +250,7 @@ - dummy--1.0.sql - dummy--2.0.sql - dummy--3.0.sql - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: add update paths file: @@ -260,7 +260,7 @@ with_items: - dummy--1.0--2.0.sql - dummy--2.0--3.0.sql - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: Get PostgreSQL version become_user: '{{ pg_user }}' diff --git a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-11.yml b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-11.yml index a92de47cb2..dae40becfa 100644 --- a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-11.yml +++ b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-11.yml @@ -5,7 +5,7 @@ postgresql_packages: - postgresql95-server - - "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2" + - "py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-psycopg2" pg_dir: /usr/local/pgsql/data pg_hba_location: "{{ pg_dir }}/pg_hba.conf" diff --git a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.0.yml b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.0.yml index a92de47cb2..dae40becfa 100644 --- a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.0.yml +++ b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.0.yml @@ -5,7 +5,7 @@ postgresql_packages: - postgresql95-server - - "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2" + - "py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-psycopg2" pg_dir: /usr/local/pgsql/data pg_hba_location: "{{ pg_dir }}/pg_hba.conf" diff --git a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.1.yml b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.1.yml index 8e5ddfa137..59e9c4f498 100644 --- a/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.1.yml +++ b/tests/integration/targets/setup_postgresql_db/vars/FreeBSD-12.1.yml @@ -5,7 +5,7 @@ postgresql_packages: - postgresql11-server - - "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2" + - "py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-psycopg2" pg_dir: /var/db/postgres/data11 pg_hba_location: "{{ pg_dir }}/pg_hba.conf" diff --git a/tests/integration/targets/setup_redis_replication/defaults/main.yml b/tests/integration/targets/setup_redis_replication/defaults/main.yml index cc2d632b85..2501854185 100644 --- a/tests/integration/targets/setup_redis_replication/defaults/main.yml +++ b/tests/integration/targets/setup_redis_replication/defaults/main.yml @@ -28,7 +28,7 @@ redis_user: Debian: redis Ubuntu: redis openSUSE Leap: redis - Fedora: "{{ '998' if ansible_distribution_major_version is version('41', '>=') else 'redis' }}" + Fedora: "{{ '998' if ansible_facts.distribution_major_version is version('41', '>=') else 'redis' }}" CentOS: redis FreeBSD: redis @@ -38,7 +38,7 @@ redis_bin: Debian: /usr/bin/redis-server Ubuntu: /usr/bin/redis-server openSUSE Leap: /usr/sbin/redis-server - Fedora: "/usr/bin/{{ 'valkey-server' if ansible_distribution_major_version is version('41', '>=') else 'redis-server' }}" + Fedora: "/usr/bin/{{ 'valkey-server' if ansible_facts.distribution_major_version is version('41', '>=') else 'redis-server' }}" CentOS: /usr/bin/redis-server FreeBSD: /usr/local/bin/redis-server @@ -48,9 +48,9 @@ redis_password: PASS old_redis: >- {{ - (ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7) or - (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int <= 18) or - (ansible_os_family == 'FreeBSD' and ansible_distribution_major_version|int <= 12) + (ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version|int <= 7) or + (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version|int <= 18) or + (ansible_facts.os_family == 'FreeBSD' and ansible_facts.distribution_major_version|int <= 12) }} # Master diff --git a/tests/integration/targets/setup_redis_replication/handlers/main.yml b/tests/integration/targets/setup_redis_replication/handlers/main.yml index 46c7571da1..f451c92e96 100644 --- a/tests/integration/targets/setup_redis_replication/handlers/main.yml +++ b/tests/integration/targets/setup_redis_replication/handlers/main.yml @@ -14,7 +14,7 @@ args: name: "{{ item }}" state: absent - loop: "{{ redis_packages[ansible_distribution] }}" + loop: "{{ redis_packages[ansible_facts.distribution] }}" listen: cleanup redis - name: remove pip packages diff --git a/tests/integration/targets/setup_redis_replication/tasks/main.yml b/tests/integration/targets/setup_redis_replication/tasks/main.yml index 92ac4fe750..c6074d7f32 100644 --- a/tests/integration/targets/setup_redis_replication/tasks/main.yml +++ b/tests/integration/targets/setup_redis_replication/tasks/main.yml @@ -9,4 +9,4 @@ - import_tasks: setup_redis_cluster.yml when: - - ansible_distribution in ['CentOS', 'Fedora', 'FreeBSD', 'openSUSE Leap', 'Ubuntu', 'Debian', 'Archlinux', 'Alpine'] + - ansible_facts.distribution in ['CentOS', 'Fedora', 'FreeBSD', 'openSUSE Leap', 'Ubuntu', 'Debian', 'Archlinux', 'Alpine'] diff --git a/tests/integration/targets/setup_redis_replication/tasks/setup_redis_cluster.yml b/tests/integration/targets/setup_redis_replication/tasks/setup_redis_cluster.yml index 3c9c62ba00..354a763d20 100644 --- a/tests/integration/targets/setup_redis_replication/tasks/setup_redis_cluster.yml +++ b/tests/integration/targets/setup_redis_replication/tasks/setup_redis_cluster.yml @@ -8,7 +8,7 @@ - name: Install redis dependencies package: - name: "{{ redis_packages[ansible_distribution] }}" + name: "{{ redis_packages[ansible_facts.distribution] }}" state: latest policy_rc_d: "{{ 101 if ansible_facts.pkg_mgr == 'apt' else omit }}" notify: cleanup redis @@ -24,8 +24,8 @@ file: path: "{{ item }}" state: directory - owner: "{{ redis_user[ansible_distribution] }}" - group: "{{ redis_user[ansible_distribution] }}" + owner: "{{ redis_user[ansible_facts.distribution] }}" + group: "{{ redis_user[ansible_facts.distribution] }}" loop: - "{{ master_datadir }}" - "{{ master_logdir }}" @@ -54,10 +54,10 @@ datadir: "{{ replica_datadir }}" - name: Start redis master - ansible.builtin.command: "{{ redis_bin[ansible_distribution] }} {{ master_conf }}" + ansible.builtin.command: "{{ redis_bin[ansible_facts.distribution] }} {{ master_conf }}" - name: Start redis replica - ansible.builtin.command: "{{ redis_bin[ansible_distribution] }} {{ replica_conf }} --{% if old_redis %}slaveof{% else %}replicaof{% endif %} 127.0.0.1 {{ master_port }}" + ansible.builtin.command: "{{ redis_bin[ansible_facts.distribution] }} {{ replica_conf }} --{% if old_redis %}slaveof{% else %}replicaof{% endif %} 127.0.0.1 {{ master_port }}" - name: Wait for redis master to be started ansible.builtin.wait_for: diff --git a/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml b/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml index 6632cc8489..ad3dd96066 100644 --- a/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml +++ b/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml @@ -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 -- name: make sure we have the ansible_os_family and ansible_distribution_version facts +- name: make sure we have the ansible_facts.os_family and ansible_facts.distribution_version facts setup: gather_subset: distribution when: ansible_facts == {} @@ -16,5 +16,5 @@ - include_tasks: "{{ lookup('first_found', files)}}" vars: files: - - "{{ ansible_os_family | lower }}.yml" + - "{{ ansible_facts.os_family | lower }}.yml" - "default.yml" diff --git a/tests/integration/targets/setup_remote_tmp_dir_outside_tmp/tasks/main.yml b/tests/integration/targets/setup_remote_tmp_dir_outside_tmp/tasks/main.yml index 6632cc8489..ad3dd96066 100644 --- a/tests/integration/targets/setup_remote_tmp_dir_outside_tmp/tasks/main.yml +++ b/tests/integration/targets/setup_remote_tmp_dir_outside_tmp/tasks/main.yml @@ -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 -- name: make sure we have the ansible_os_family and ansible_distribution_version facts +- name: make sure we have the ansible_facts.os_family and ansible_facts.distribution_version facts setup: gather_subset: distribution when: ansible_facts == {} @@ -16,5 +16,5 @@ - include_tasks: "{{ lookup('first_found', files)}}" vars: files: - - "{{ ansible_os_family | lower }}.yml" + - "{{ ansible_facts.os_family | lower }}.yml" - "default.yml" diff --git a/tests/integration/targets/setup_rundeck/tasks/main.yml b/tests/integration/targets/setup_rundeck/tasks/main.yml index ea8b35f65e..795101cb9b 100644 --- a/tests/integration/targets/setup_rundeck/tasks/main.yml +++ b/tests/integration/targets/setup_rundeck/tasks/main.yml @@ -10,11 +10,11 @@ - name: Skip unsupported platforms meta: end_play - when: ansible_distribution not in ['CentOS', 'Fedora', 'Debian', 'Ubuntu'] + when: ansible_facts.distribution not in ['CentOS', 'Fedora', 'Debian', 'Ubuntu'] - name: Include OS-specific variables - include_vars: '{{ ansible_os_family }}.yml' - when: ansible_os_family in ['Debian', 'RedHat'] + include_vars: '{{ ansible_facts.os_family }}.yml' + when: ansible_facts.os_family in ['Debian', 'RedHat'] - name: Set Rundeck base dir set_fact: diff --git a/tests/integration/targets/setup_snap/tasks/main.yml b/tests/integration/targets/setup_snap/tasks/main.yml index 8f3744a70e..8014e932b0 100644 --- a/tests/integration/targets/setup_snap/tasks/main.yml +++ b/tests/integration/targets/setup_snap/tasks/main.yml @@ -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: Include distribution specific tasks include_tasks: "{{ lookup('first_found', params) }}" diff --git a/tests/integration/targets/setup_wildfly_server/tasks/main.yml b/tests/integration/targets/setup_wildfly_server/tasks/main.yml index 26f5083b0a..17ea06ca7c 100644 --- a/tests/integration/targets/setup_wildfly_server/tasks/main.yml +++ b/tests/integration/targets/setup_wildfly_server/tasks/main.yml @@ -10,8 +10,8 @@ - name: Skip unsupported platforms meta: end_play - when: (ansible_distribution != 'CentOS') or - (ansible_distribution == 'CentOS' and ansible_distribution_major_version is not version('7', '>=')) + when: (ansible_facts.distribution != 'CentOS') or + (ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version is not version('7', '>=')) - name: Install java package: diff --git a/tests/integration/targets/shutdown/tasks/main.yml b/tests/integration/targets/shutdown/tasks/main.yml index 2903248407..4c70f5772d 100644 --- a/tests/integration/targets/shutdown/tasks/main.yml +++ b/tests/integration/targets/shutdown/tasks/main.yml @@ -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" diff --git a/tests/integration/targets/sudoers/tasks/main.yml b/tests/integration/targets/sudoers/tasks/main.yml index fa03b71dac..6eb2a358f7 100644 --- a/tests/integration/targets/sudoers/tasks/main.yml +++ b/tests/integration/targets/sudoers/tasks/main.yml @@ -13,7 +13,7 @@ - name: Install sudo package ansible.builtin.package: name: sudo - when: ansible_os_family != 'Darwin' + when: ansible_facts.os_family != 'Darwin' - name: Ensure sudoers directory exists ansible.builtin.file: @@ -211,13 +211,13 @@ command: cmd: which visudo register: which_visudo - when: ansible_os_family != 'Darwin' + when: ansible_facts.os_family != 'Darwin' - name: Prevent visudo being executed file: path: "{{ which_visudo.stdout }}" mode: '-x' - when: ansible_os_family != 'Darwin' + when: ansible_facts.os_family != 'Darwin' - name: Attempt command without full path to executable, but enforcing validation with no visudo present community.general.sudoers: @@ -227,7 +227,7 @@ commands: systemctl validation: required ignore_errors: true - when: ansible_os_family != 'Darwin' + when: ansible_facts.os_family != 'Darwin' register: edge_case_3 - name: Revoke non-existing rule @@ -293,4 +293,4 @@ that: - edge_case_3 is failed - "'Failed to find required executable' in edge_case_3.msg" - when: ansible_os_family != 'Darwin' + when: ansible_facts.os_family != 'Darwin' diff --git a/tests/integration/targets/supervisorctl/tasks/main.yml b/tests/integration/targets/supervisorctl/tasks/main.yml index dd47971a31..4cf3625759 100644 --- a/tests/integration/targets/supervisorctl/tasks/main.yml +++ b/tests/integration/targets/supervisorctl/tasks/main.yml @@ -10,9 +10,9 @@ - when: # setuptools is too old on RHEL/CentOS 6 (https://github.com/Supervisor/meld3/issues/23) - - ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6 + - ansible_facts.os_family != 'RedHat' or ansible_facts.distribution_major_version|int > 6 # For some reason CentOS 7 and OpenSuSE 15 do not work on ansible-core 2.16 - - ansible_version.minor != 16 or ansible_distribution not in ['CentOS', 'openSUSE Leap'] + - ansible_version.minor != 16 or ansible_facts.distribution not in ['CentOS', 'openSUSE Leap'] block: - block: - tempfile: @@ -28,16 +28,16 @@ - include_vars: '{{ item }}' with_first_found: - files: - - '{{ ansible_distribution }}.yml' - - '{{ ansible_os_family }}.yml' + - '{{ ansible_facts.distribution }}.yml' + - '{{ ansible_facts.os_family }}.yml' - 'defaults.yml' - include_tasks: '{{ item }}' with_first_found: - files: - - 'install_{{ ansible_distribution }}.yml' # CentOS - - 'install_{{ ansible_os_family }}.yml' # RedHat - - 'install_{{ ansible_system }}.yml' # Linux + - 'install_{{ ansible_facts.distribution }}.yml' # CentOS + - 'install_{{ ansible_facts.os_family }}.yml' # RedHat + - 'install_{{ ansible_facts.system }}.yml' # Linux - include_tasks: test.yml with_items: @@ -50,9 +50,9 @@ - include_tasks: '{{ item }}' with_first_found: - files: - - 'uninstall_{{ ansible_distribution }}.yml' # CentOS - - 'uninstall_{{ ansible_os_family }}.yml' # RedHat - - 'uninstall_{{ ansible_system }}.yml' # Linux + - 'uninstall_{{ ansible_facts.distribution }}.yml' # CentOS + - 'uninstall_{{ ansible_facts.os_family }}.yml' # RedHat + - 'uninstall_{{ ansible_facts.system }}.yml' # Linux - file: path: '{{ supervisord_sock_path.path }}' diff --git a/tests/integration/targets/supervisorctl/templates/supervisord.conf b/tests/integration/targets/supervisorctl/templates/supervisord.conf index f3d36b92e7..faa67f46e3 100644 --- a/tests/integration/targets/supervisorctl/templates/supervisord.conf +++ b/tests/integration/targets/supervisorctl/templates/supervisord.conf @@ -9,16 +9,16 @@ pidfile={{ remote_dir }}/supervisord.pid logfile={{ remote_dir }}/supervisord.log [program:py1] -command={{ ansible_python.executable }} -i -u - -user={{ ansible_user_id }} +command={{ ansible_facts.python.executable }} -i -u - +user={{ ansible_facts.user_id }} autostart=false autorestart=false stdout_logfile={{ remote_dir }}/py1.log redirect_stderr=yes [program:py2] -command={{ ansible_python.executable }} -i -u - -user={{ ansible_user_id }} +command={{ ansible_facts.python.executable }} -i -u - +user={{ ansible_facts.user_id }} autostart=false autorestart=false stdout_logfile={{ remote_dir }}/py2.log diff --git a/tests/integration/targets/sysrc/tasks/main.yml b/tests/integration/targets/sysrc/tasks/main.yml index c9f5a4b232..b2f0dbdcd8 100644 --- a/tests/integration/targets/sysrc/tasks/main.yml +++ b/tests/integration/targets/sysrc/tasks/main.yml @@ -144,9 +144,9 @@ # NOTE: currently fails with FreeBSD 14 with minor version less than 2 # when: >- - ansible_distribution_version is version('12.4', '>=') and ansible_distribution_version is version('13', '<') - or ansible_distribution_version is version('13.4', '>=') and ansible_distribution_version is version('14', '<') - or ansible_distribution_version is version('14.3', '>=') + ansible_facts.distribution_version is version('12.4', '>=') and ansible_facts.distribution_version is version('13', '<') + or ansible_facts.distribution_version is version('13.4', '>=') and ansible_facts.distribution_version is version('14', '<') + or ansible_facts.distribution_version is version('14.3', '>=') block: - name: Setup testjail include_tasks: setup-testjail.yml diff --git a/tests/integration/targets/sysrc/tasks/setup-testjail.yml b/tests/integration/targets/sysrc/tasks/setup-testjail.yml index 8aac7a430d..a845ed7ef6 100644 --- a/tests/integration/targets/sysrc/tasks/setup-testjail.yml +++ b/tests/integration/targets/sysrc/tasks/setup-testjail.yml @@ -22,14 +22,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 diff --git a/tests/integration/targets/systemd_creds_decrypt/tasks/main.yaml b/tests/integration/targets/systemd_creds_decrypt/tasks/main.yaml index 2249bd7fa9..d175c89ece 100644 --- a/tests/integration/targets/systemd_creds_decrypt/tasks/main.yaml +++ b/tests/integration/targets/systemd_creds_decrypt/tasks/main.yaml @@ -5,8 +5,8 @@ - name: Test systemd_creds_decrypt when: - - ansible_systemd.version is defined - - ansible_systemd.version | int >= 250 + - ansible_facts.systemd.version is defined + - ansible_facts.systemd.version | int >= 250 block: - name: Encrypt secret become: true diff --git a/tests/integration/targets/systemd_creds_encrypt/tasks/main.yaml b/tests/integration/targets/systemd_creds_encrypt/tasks/main.yaml index 8ed45b2dc3..f11a60d2e4 100644 --- a/tests/integration/targets/systemd_creds_encrypt/tasks/main.yaml +++ b/tests/integration/targets/systemd_creds_encrypt/tasks/main.yaml @@ -5,8 +5,8 @@ - name: Test systemd_creds_encrypt when: - - ansible_systemd.version is defined - - ansible_systemd.version | int >= 250 + - ansible_facts.systemd.version is defined + - ansible_facts.systemd.version | int >= 250 block: - name: Encrypt secret become: true diff --git a/tests/integration/targets/systemd_info/tasks/main.yml b/tests/integration/targets/systemd_info/tasks/main.yml index e41816195b..5dcaec10b5 100644 --- a/tests/integration/targets/systemd_info/tasks/main.yml +++ b/tests/integration/targets/systemd_info/tasks/main.yml @@ -5,11 +5,11 @@ - name: skip Alpine meta: end_host - when: ansible_distribution == 'Alpine' + when: ansible_facts.distribution == 'Alpine' -- name: check ansible_service_mgr +- name: check ansible_facts.service_mgr ansible.builtin.assert: - that: ansible_service_mgr == 'systemd' + that: ansible_facts.service_mgr == 'systemd' - name: Test systemd_facts block: @@ -18,9 +18,9 @@ import_tasks: tests.yml when: > - (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version is version('7', '>=')) or - ansible_distribution == 'Fedora' or - (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('15.04', '>=')) or - (ansible_distribution == 'Debian' and ansible_distribution_version is version('8', '>=')) or - ansible_os_family == 'Suse' or - ansible_distribution == 'Archlinux' \ No newline at end of file + (ansible_facts.distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_facts.distribution_major_version is version('7', '>=')) or + ansible_facts.distribution == 'Fedora' or + (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version is version('15.04', '>=')) or + (ansible_facts.distribution == 'Debian' and ansible_facts.distribution_version is version('8', '>=')) or + ansible_facts.os_family == 'Suse' or + ansible_facts.distribution == 'Archlinux' \ No newline at end of file diff --git a/tests/integration/targets/terraform/vars/main.yml b/tests/integration/targets/terraform/vars/main.yml index 17032ea81f..32c10ad41f 100644 --- a/tests/integration/targets/terraform/vars/main.yml +++ b/tests/integration/targets/terraform/vars/main.yml @@ -8,7 +8,7 @@ terraform_version: 1.1.7 # Architecture of the downloaded Terraform release (needs to match target testing platform) -terraform_arch: "{{ ansible_system | lower }}_{{terraform_arch_map[ansible_architecture] }}" +terraform_arch: "{{ ansible_facts.system | lower }}_{{terraform_arch_map[ansible_facts.architecture] }}" # URL of where the Terraform binary will be downloaded from terraform_url: "https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_{{ terraform_arch }}.zip" @@ -32,7 +32,7 @@ terraform_provider_versions: source: "hashicorp/null" version: ">=3.0.0" -# mapping between values returned from ansible_architecture and arch names used by golang builds of Terraform +# mapping between values returned from ansible_facts.architecture and arch names used by golang builds of Terraform # see https://www.terraform.io/downloads terraform_arch_map: diff --git a/tests/integration/targets/test_fqdn_valid/tasks/fqdn_valid_1.yml b/tests/integration/targets/test_fqdn_valid/tasks/fqdn_valid_1.yml index 3a839a0e6a..51bfa4a02d 100644 --- a/tests/integration/targets/test_fqdn_valid/tasks/fqdn_valid_1.yml +++ b/tests/integration/targets/test_fqdn_valid/tasks/fqdn_valid_1.yml @@ -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: debug_test|default(false)|bool - tags: t0 - - name: 1. Test valid hostnames. Default options. block: - name: "1. Default min_labels=1, allow_underscores=False" diff --git a/tests/integration/targets/timezone/tasks/main.yml b/tests/integration/targets/timezone/tasks/main.yml index cb76d382ba..3766d82f85 100644 --- a/tests/integration/targets/timezone/tasks/main.yml +++ b/tests/integration/targets/timezone/tasks/main.yml @@ -23,12 +23,12 @@ - name: set config file path on Debian set_fact: timezone_config_file: '/etc/timezone' - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: set config file path on RedHat set_fact: timezone_config_file: '/etc/sysconfig/clock' - when: ansible_os_family == 'RedHat' + when: ansible_facts.os_family == 'RedHat' ## ## set path to hwclock config files @@ -37,12 +37,12 @@ - name: set config file path on Debian set_fact: hwclock_config_file: '/etc/default/rcS' - when: ansible_os_family == 'Debian' + when: ansible_facts.os_family == 'Debian' - name: set config file path on RedHat set_fact: hwclock_config_file: '/etc/sysconfig/clock' - when: ansible_os_family == 'RedHat' + when: ansible_facts.os_family == 'RedHat' #### #### timezone tests @@ -52,33 +52,33 @@ package: name: diffutils state: present - when: ansible_distribution == 'Archlinux' + when: ansible_facts.distribution == 'Archlinux' - name: make sure util-linux-extra are installed on Debian 13+ package: name: util-linux-extra state: present - when: ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 13 + when: ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version|int >= 13 - name: make sure tzdata is installed on Alpine package: name: tzdata state: present - when: ansible_distribution == 'Alpine' + when: ansible_facts.distribution == 'Alpine' - name: make sure hwclock is installed in Ubuntu 24.04 package: name: util-linux-extra state: present when: - - ansible_distribution == 'Ubuntu' + - ansible_facts.distribution == 'Ubuntu' - ansible_facts.distribution_major_version is version('24', '>=') - name: Run tests when: - - not (ansible_os_family == 'Alpine') # TODO - - not (ansible_distribution == 'Archlinux') # TODO + - not (ansible_facts.os_family == 'Alpine') # TODO + - not (ansible_facts.distribution == 'Archlinux') # TODO block: - name: set timezone to Etc/UTC timezone: diff --git a/tests/integration/targets/timezone/tasks/test.yml b/tests/integration/targets/timezone/tasks/test.yml index 1a6787484d..3bcb3b89c1 100644 --- a/tests/integration/targets/timezone/tasks/test.yml +++ b/tests/integration/targets/timezone/tasks/test.yml @@ -29,14 +29,14 @@ - name: ensure that checkmode didn't update the timezone in the config file command: egrep '^(TIME)?ZONE="Etc/UTC"' {{ timezone_config_file }} when: - - ansible_service_mgr != 'systemd' - - ansible_os_family == 'RedHat' + - ansible_facts.service_mgr != 'systemd' + - ansible_facts.os_family == 'RedHat' - name: ensure that checkmode didn't update the timezone in the config file command: egrep '^Etc/UTC' {{ timezone_config_file }} when: - - ansible_service_mgr != 'systemd' - - ansible_os_family == 'Debian' + - ansible_facts.service_mgr != 'systemd' + - ansible_facts.os_family == 'Debian' - name: set timezone to Australia/Brisbane timezone: @@ -57,14 +57,14 @@ - name: ensure that the timezone is updated in the config file command: egrep '^(TIME)?ZONE="Australia/Brisbane"' {{ timezone_config_file }} when: - - ansible_service_mgr != 'systemd' - - ansible_os_family == 'RedHat' + - ansible_facts.service_mgr != 'systemd' + - ansible_facts.os_family == 'RedHat' - name: ensure that the timezone is updated in the config file command: egrep '^Australia/Brisbane' {{ timezone_config_file }} when: - - ansible_service_mgr != 'systemd' - - ansible_os_family == 'Debian' + - ansible_facts.service_mgr != 'systemd' + - ansible_facts.os_family == 'Debian' - name: set timezone to Australia/Brisbane again timezone: @@ -272,7 +272,7 @@ command: cmp /etc/localtime /usr/share/zoneinfo/Europe/Belgrade changed_when: false when: - - ansible_service_mgr != 'systemd' + - ansible_facts.service_mgr != 'systemd' - timezone_config_file is defined @@ -323,7 +323,7 @@ - name: ensure that checkmode didn't update hwclock the config file command: grep ^UTC=no {{ hwclock_config_file }} - when: ansible_service_mgr != 'systemd' + when: ansible_facts.service_mgr != 'systemd' - name: set hwclock to UTC timezone: @@ -343,7 +343,7 @@ - name: ensure that hwclock is updated in the config file command: grep ^UTC=yes {{ hwclock_config_file }} - when: ansible_service_mgr != 'systemd' + when: ansible_facts.service_mgr != 'systemd' - name: set hwclock to RTC again timezone: @@ -490,7 +490,7 @@ - hwclock_set_local_broken_adjtime.diff.after.hwclock == 'local' - hwclock_set_local_broken_adjtime.diff.before.hwclock == 'UTC' when: - - ansible_service_mgr != 'systemd' + - ansible_facts.service_mgr != 'systemd' - hwclock_config_file is defined #### @@ -532,12 +532,12 @@ - name: ensure that checkmode didn't update the timezone in the config file command: egrep '^(TIME)?ZONE="Etc/UTC"' {{ timezone_config_file }} when: - - ansible_os_family == 'RedHat' + - ansible_facts.os_family == 'RedHat' - name: ensure that checkmode didn't update the timezone in the config file command: egrep '^Etc/UTC' {{ timezone_config_file }} when: - - ansible_os_family == 'Debian' + - ansible_facts.os_family == 'Debian' - name: ensure that checkmode didn't update hwclock in /etc/adjtime command: grep ^UTC /etc/adjtime @@ -546,7 +546,7 @@ - name: ensure that checkmode didn't update hwclock the config file command: grep ^UTC=no {{ hwclock_config_file }} - when: ansible_service_mgr != 'systemd' + when: ansible_facts.service_mgr != 'systemd' - name: set timezone to Europe/Belgrade and hwclock to UTC timezone: @@ -571,19 +571,19 @@ - name: ensure that the timezone is updated in the config file command: egrep '^(TIME)?ZONE="Europe/Belgrade"' {{ timezone_config_file }} when: - - ansible_os_family == 'RedHat' + - ansible_facts.os_family == 'RedHat' - name: ensure that the timezone is updated in the config file command: egrep 'Europe/Belgrade' {{ timezone_config_file }} when: - - ansible_os_family == 'Debian' + - ansible_facts.os_family == 'Debian' - name: ensure that hwclock is updated in /etc/adjtime command: grep ^UTC /etc/adjtime - name: ensure that hwclock is updated in the config file command: grep ^UTC=yes {{ hwclock_config_file }} - when: ansible_service_mgr != 'systemd' + when: ansible_facts.service_mgr != 'systemd' - name: set timezone to Europe/Belgrade and hwclock to UTC again timezone: @@ -608,5 +608,5 @@ - not tzclock_set_again_checkmode.changed when: - - ansible_system == 'Linux' + - ansible_facts.system == 'Linux' - hwclock_supported diff --git a/tests/integration/targets/ufw/tasks/main.yml b/tests/integration/targets/ufw/tasks/main.yml index 83e6a5138a..23e5110bc1 100644 --- a/tests/integration/targets/ufw/tasks/main.yml +++ b/tests/integration/targets/ufw/tasks/main.yml @@ -13,13 +13,13 @@ 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 iptables (SuSE only) package: name: iptables become: true - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' - name: Install ufw become: true package: diff --git a/tests/integration/targets/xfs_quota/tasks/main.yml b/tests/integration/targets/xfs_quota/tasks/main.yml index 8977cf9ec7..2e828c220d 100644 --- a/tests/integration/targets/xfs_quota/tasks/main.yml +++ b/tests/integration/targets/xfs_quota/tasks/main.yml @@ -9,7 +9,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later - name: setup Alpine - when: ansible_distribution == 'Alpine' + when: ansible_facts.distribution == 'Alpine' package: name: - xfsprogs diff --git a/tests/integration/targets/xml/tasks/main.yml b/tests/integration/targets/xml/tasks/main.yml index 5c2c01ed53..620fcb0331 100644 --- a/tests/integration/targets/xml/tasks/main.yml +++ b/tests/integration/targets/xml/tasks/main.yml @@ -10,9 +10,9 @@ - name: Install lxml (FreeBSD) package: - name: 'py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-lxml' + name: 'py{{ ansible_facts.python.version.major }}{{ ansible_facts.python.version.minor }}-lxml' state: present - when: ansible_os_family == "FreeBSD" + when: ansible_facts.os_family == "FreeBSD" - name: Install requirements (RHEL 8) package: @@ -21,14 +21,14 @@ - libxslt-devel - python3-lxml state: present - when: ansible_distribution == "RedHat" and ansible_distribution_major_version == "8" + when: ansible_facts.distribution == "RedHat" and ansible_facts.distribution_major_version == "8" # Needed for MacOSX ! - name: Install lxml pip: name: lxml state: present -# when: ansible_os_family == "Darwin" +# when: ansible_facts.os_family == "Darwin" - name: Get lxml version command: "{{ ansible_python_interpreter }} -c 'from lxml import etree; print(\".\".join(str(v) for v in etree.LXML_VERSION))'" diff --git a/tests/integration/targets/yarn/tasks/main.yml b/tests/integration/targets/yarn/tasks/main.yml index e12d891c29..28895a1b36 100644 --- a/tests/integration/targets/yarn/tasks/main.yml +++ b/tests/integration/targets/yarn/tasks/main.yml @@ -14,10 +14,10 @@ - include_tasks: run.yml vars: nodejs_version: '{{ item.node_version }}' - 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 }}' yarn_version: '{{ item.yarn_version }}' with_items: - {node_version: 4.8.0, yarn_version: 1.6.0} # Lowest compatible nodejs version - {node_version: 8.0.0, yarn_version: 1.6.0} when: - - not (ansible_os_family == 'Alpine') # TODO + - not (ansible_facts.os_family == 'Alpine') # TODO diff --git a/tests/integration/targets/yarn/tasks/run.yml b/tests/integration/targets/yarn/tasks/run.yml index d48eacc4d4..7f257c643d 100644 --- a/tests/integration/targets/yarn/tasks/run.yml +++ b/tests/integration/targets/yarn/tasks/run.yml @@ -38,14 +38,14 @@ yarn_bin_path: "{{ remote_tmp_dir }}/yarn-v{{ yarn_version }}/bin" package: 'iconv-lite' environment: - PATH: "{{ node_bin_path }}:{{ansible_env.PATH}}" + PATH: "{{ node_bin_path }}:{{ansible_facts.env.PATH}}" YARN_IGNORE_ENGINES: true block: # Get the version of Yarn and register to a variable - shell: '{{ yarn_bin_path }}/yarn --version' environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_version - name: 'Create dummy package.json' @@ -59,7 +59,7 @@ executable: '{{ yarn_bin_path }}/yarn' 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.' yarn: @@ -68,7 +68,7 @@ name: '{{ package }}' state: present environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_install - assert: @@ -81,7 +81,7 @@ executable: '{{ yarn_bin_path }}/yarn' state: present environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' check_mode: true register: yarn_install_check @@ -101,7 +101,7 @@ version: 1.1.0 state: present environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_install_old_package - assert: @@ -115,7 +115,7 @@ version: 1.1.0 state: present environment: - PATH: '{{ yarn_bin_path }}:{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ yarn_bin_path }}:{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' - name: 'Upgrade old package' yarn: @@ -124,7 +124,7 @@ name: left-pad state: latest environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_update_old_package - assert: @@ -138,7 +138,7 @@ name: '{{ package }}' state: absent environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_uninstall_package - name: 'Assert package removed' @@ -154,7 +154,7 @@ version: 2.0.0 state: present environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_install_old_binary - assert: @@ -168,7 +168,7 @@ name: prettier state: latest environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_update_old_binary - assert: @@ -182,7 +182,7 @@ name: prettier state: absent environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_uninstall_binary - assert: @@ -197,7 +197,7 @@ version: 1.1.0 state: present environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_install_old_package - assert: @@ -211,7 +211,7 @@ name: left-pad state: latest environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_update_old_package - assert: @@ -225,7 +225,7 @@ name: left-pad state: absent environment: - PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}' + PATH: '{{ node_bin_path }}:{{ ansible_facts.env.PATH }}' register: yarn_global_uninstall_package - assert: diff --git a/tests/integration/targets/yum_versionlock/tasks/main.yml b/tests/integration/targets/yum_versionlock/tasks/main.yml index 05f1f74954..6c89081853 100644 --- a/tests/integration/targets/yum_versionlock/tasks/main.yml +++ b/tests/integration/targets/yum_versionlock/tasks/main.yml @@ -12,7 +12,7 @@ yum: name: procps-ng state: latest - when: ansible_distribution == 'Fedora' and ansible_distribution_major_version == '34' + when: ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version == '34' - block: - name: Install necessary packages to test yum_versionlock @@ -83,5 +83,5 @@ name: yum-plugin-versionlock state: absent when: yum_versionlock_install is changed - when: (ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version is version('7', '>=')) or - (ansible_distribution == 'Fedora') + when: (ansible_facts.distribution in ['CentOS', 'RedHat'] and ansible_facts.distribution_major_version is version('7', '>=')) or + (ansible_facts.distribution == 'Fedora') diff --git a/tests/integration/targets/zpool/tasks/main.yml b/tests/integration/targets/zpool/tasks/main.yml index b5eefc2ffd..ce2ab9cb46 100644 --- a/tests/integration/targets/zpool/tasks/main.yml +++ b/tests/integration/targets/zpool/tasks/main.yml @@ -13,7 +13,7 @@ loop: "{{ zpool_disk_configs }}" - name: Include distribution specific install_requirements.yml - ansible.builtin.include_tasks: install_requirements_{{ ansible_distribution | lower }}.yml + ansible.builtin.include_tasks: install_requirements_{{ ansible_facts.distribution | lower }}.yml - name: Include create_destroy.yml ansible.builtin.include_tasks: create_destroy.yml diff --git a/tests/integration/targets/zypper/tasks/main.yml b/tests/integration/targets/zypper/tasks/main.yml index 185f2f90ab..9a8c0616aa 100644 --- a/tests/integration/targets/zypper/tasks/main.yml +++ b/tests/integration/targets/zypper/tasks/main.yml @@ -12,4 +12,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later - include_tasks: 'zypper.yml' - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' diff --git a/tests/integration/targets/zypper/tasks/zypper.yml b/tests/integration/targets/zypper/tasks/zypper.yml index ae7dc83b4a..e71de15a03 100644 --- a/tests/integration/targets/zypper/tasks/zypper.yml +++ b/tests/integration/targets/zypper/tasks/zypper.yml @@ -9,7 +9,7 @@ - name: set URL of test package set_fact: - hello_package_url: https://download.opensuse.org/distribution/leap/{{ ansible_distribution_version }}/repo/oss/x86_64/hello-{{ hello_version.stdout }}.x86_64.rpm + hello_package_url: https://download.opensuse.org/distribution/leap/{{ ansible_facts.distribution_version }}/repo/oss/x86_64/hello-{{ hello_version.stdout }}.x86_64.rpm - debug: var=hello_package_url diff --git a/tests/integration/targets/zypper_repository/tasks/main.yml b/tests/integration/targets/zypper_repository/tasks/main.yml index 1d655a56fc..13f84581ac 100644 --- a/tests/integration/targets/zypper_repository/tasks/main.yml +++ b/tests/integration/targets/zypper_repository/tasks/main.yml @@ -10,4 +10,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later - include_tasks: 'test.yml' - when: ansible_os_family == 'Suse' + when: ansible_facts.os_family == 'Suse' diff --git a/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml b/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml index 8c322421c4..7518497fc3 100644 --- a/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml +++ b/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml @@ -42,7 +42,7 @@ community.general.zypper_repository: name: test state: present - repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/ + repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_facts.distribution_version }}/ register: zypper_result - name: Verify change on URL only change @@ -55,7 +55,7 @@ name: testrefresh refresh: false state: present - repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/ + repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_facts.distribution_version }}/ - name: check refreshoption command: zypper -x lr testrefresh @@ -71,7 +71,7 @@ name: testprio priority: 55 state: present - repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/ + repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_facts.distribution_version }}/ - name: check refreshoption command: zypper -x lr testprio @@ -114,8 +114,8 @@ state: present repo: "{{ item }}" with_items: - - http://download.opensuse.org/repositories/science/openSUSE_Leap_{{ ansible_distribution_version }}/ - - http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/ + - http://download.opensuse.org/repositories/science/openSUSE_Leap_{{ ansible_facts.distribution_version }}/ + - http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_facts.distribution_version }}/ - name: check repo is updated by name command: zypper lr samename @@ -129,7 +129,7 @@ - name: remove last added repos (by URL to test that) community.general.zypper_repository: - repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/ + repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_facts.distribution_version }}/ state: absent # FIXME: this currently fails with `Repository 'Apache_PHP_Modules' is invalid.` @@ -163,7 +163,7 @@ - name: remove added repo community.general.zypper_repository: - repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/ + repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_facts.distribution_version }}/ state: absent register: remove_repo @@ -216,11 +216,11 @@ # For now, the URL does not work for 15.4 # FIXME: Try to get this working with newer versions # (Maybe 'Uyuni' needs to be replaced with something else?) -- when: ansible_distribution_version is version('15.4', '<') +- when: ansible_facts.distribution_version is version('15.4', '<') block: - name: add new repository via url to .repo file community.general.zypper_repository: - repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_distribution_version }}/systemsmanagement:Uyuni:Stable.repo + repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_facts.distribution_version }}/systemsmanagement:Uyuni:Stable.repo state: present register: added_by_repo_file @@ -237,7 +237,7 @@ - name: add same repository via url to .repo file again to verify idempotency community.general.zypper_repository: - repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_distribution_version }}/systemsmanagement:Uyuni:Stable.repo + repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_facts.distribution_version }}/systemsmanagement:Uyuni:Stable.repo state: present register: added_again_by_repo_file @@ -248,7 +248,7 @@ - name: remove repository via url to .repo file community.general.zypper_repository: - repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_distribution_version }}/systemsmanagement:Uyuni:Stable.repo + repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_facts.distribution_version }}/systemsmanagement:Uyuni:Stable.repo state: absent register: removed_by_repo_file