From 0c590cdf5acf2fdebdc3ed914a72d118b818905a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 20 Nov 2023 13:46:10 -0700 Subject: [PATCH] refactor: improve support for ostree systems The dependency on `ansible.utils.update_fact` is causing issue with some users who now must install that collection in order to run the role, even if they do not care about ostree. The fix is to stop trying to set `ansible_facts.pkg_mgr`, and instead force the use of the ostree package manager with the `package:` module `use:` option. The strategy is - on ostree systems, set the flag `__$ROLENAME_is_ostree` if the system is an ostree system. The flag will either be undefined or `false` on non-ostree systems. Then, change every invocation of the `package:` module like this: ```yaml - name: Ensure required packages are present package: name: "{{ __$ROLENAME_packages }}" state: present use: "{{ (__$ROLENAME_is_ostree | d(false)) | ternary('ansible.posix.rhel_rpm_ostree', omit) }}" ``` This should ensure that the `use:` parameter is not used if the system is non-ostree. The goal is to make the ostree support as unobtrusive as possible for non-ostree systems. The user can also set `__$ROLENAME_is_ostree: true` in the inventory or play if the user knows that ostree is being used and wants to skip the check. Or, the user is concerned about the performance hit for ostree detection on non-ostree systems, and sets `__$ROLENAME_is_ostree: false` to skip the check. The flag `__$ROLENAME_is_ostree` can also be used in the role or tests to include or exclude tasks from being run on ostree systems. This fix also improves error reporting in the `get_ostree_data.sh` script when included roles cannot be found. Signed-off-by: Rich Megginson --- .ansible-lint | 2 -- .ostree/get_ostree_data.sh | 29 ++++++++++++------- meta/collection-requirements.yml | 1 - tasks/main.yml | 6 ++++ tasks/set_facts.yml | 18 ++++-------- tests/ensure_provider_tests.py | 2 ++ .../playbooks/integration_pytest_python3.yml | 4 +++ .../manual_test_ethtool_coalesce.yml | 2 ++ tests/playbooks/tests_802_1x.yml | 2 ++ tests/playbooks/tests_802_1x_updated.yml | 2 ++ tests/playbooks/tests_checkpoint_cleanup.yml | 2 ++ tests/playbooks/tests_ethtool_coalesce.yml | 2 ++ tests/playbooks/tests_ethtool_features.yml | 2 ++ tests/playbooks/tests_ethtool_ring.yml | 2 ++ tests/playbooks/tests_ipv6.yml | 2 ++ tests/playbooks/tests_network_state.yml | 2 ++ .../tests_team_plugin_installation.yml | 2 +- .../tests_wireless_plugin_installation.yml | 2 +- .../create_test_interfaces_with_dhcp.yml | 6 ++++ tests/tasks/el_repo_setup.yml | 20 +++++-------- tests/tasks/manage_test_interface.yml | 2 ++ tests/tasks/setup_802_1x_server.yml | 8 ++++- tests/tasks/setup_mock_wifi.yml | 2 ++ tests/tasks/setup_mock_wifi_wpa3_owe.yml | 4 ++- tests/tasks/setup_mock_wifi_wpa3_sae.yml | 4 ++- tests/tasks/test_802.1x_capath.yml | 4 +++ .../tests_change_indication_on_repeat_run.yml | 18 ++++-------- tests/tests_eth_pci_address_match_nm.yml | 2 ++ tests/tests_ethtool_coalesce_nm.yml | 2 ++ tests/tests_ethtool_features_nm.yml | 2 ++ tests/tests_ethtool_ring_nm.yml | 2 ++ tests/tests_provider_nm.yml | 2 ++ tests/tests_regression_nm.yml | 2 ++ tests/tests_unit.yml | 2 ++ 34 files changed, 111 insertions(+), 55 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index eeef9ca..baa5de7 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -25,5 +25,3 @@ exclude_paths: - examples/roles/ mock_roles: - linux-system-roles.network -mock_modules: - - ansible.utils.update_fact diff --git a/.ostree/get_ostree_data.sh b/.ostree/get_ostree_data.sh index 7c32524..cec08b0 100755 --- a/.ostree/get_ostree_data.sh +++ b/.ostree/get_ostree_data.sh @@ -2,7 +2,6 @@ set -euo pipefail -role_collection_dir="${ROLE_COLLECTION_DIR:-fedora/linux_system_roles}" ostree_dir="${OSTREE_DIR:-"$(dirname "$(realpath "$0")")"}" if [ -z "${4:-}" ] || [ "${1:-}" = help ] || [ "${1:-}" = -h ]; then @@ -29,7 +28,7 @@ if [ "$pkgtype" = testing ]; then fi get_rolepath() { - local ostree_dir role rolesdir roles_parent_dir + local ostree_dir role rolesdir roles_parent_dir coll_path pth ostree_dir="$1" role="$2" roles_parent_dir="$(dirname "$(dirname "$ostree_dir")")" @@ -47,16 +46,22 @@ get_rolepath() { fi done # look elsewhere - if [ -n "${ANSIBLE_COLLECTIONS_PATHS:-}" ]; then - for pth in ${ANSIBLE_COLLECTIONS_PATHS//:/ }; do - rolesdir="$pth/ansible_collections/$role_collection_dir/roles/$role/.ostree" - if [ -d "$rolesdir" ]; then - echo "$rolesdir" - return 0 - fi + coll_path="${ANSIBLE_COLLECTIONS_PATH:-}" + if [ -z "$coll_path" ]; then + coll_path="${ANSIBLE_COLLECTIONS_PATHS:-}" + fi + if [ -n "${coll_path}" ]; then + for pth in ${coll_path//:/ }; do + for rolesdir in "$pth"/ansible_collections/*/*_system_roles/roles/"$role"/.ostree; do + if [ -d "$rolesdir" ]; then + echo "$rolesdir" + return 0 + fi + done done fi - return 1 + 1>&2 echo ERROR - could not find role "$role" - please use ANSIBLE_COLLECTIONS_PATH + exit 2 } get_packages() { @@ -75,6 +80,10 @@ get_packages() { roles="$(cat "$rolefile")" for role in $roles; do rolepath="$(get_rolepath "$ostree_dir" "$role")" + if [ -z "$rolepath" ]; then + 1>&2 echo ERROR - could not find role "$role" - please use ANSIBLE_COLLECTIONS_PATH + exit 2 + fi get_packages "$rolepath" done fi diff --git a/meta/collection-requirements.yml b/meta/collection-requirements.yml index 9ddec21..a0cd255 100644 --- a/meta/collection-requirements.yml +++ b/meta/collection-requirements.yml @@ -1,4 +1,3 @@ --- collections: - name: ansible.posix - - name: ansible.utils diff --git a/tasks/main.yml b/tasks/main.yml index 82d527d..4deb3a0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,6 +31,8 @@ package: name: "{{ network_packages }}" state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - not network_packages is subset(ansible_facts.packages.keys()) register: __network_package_install @@ -41,6 +43,8 @@ - NetworkManager - nmstate state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - network_state is defined - ansible_distribution == 'Fedora' and @@ -53,6 +57,8 @@ name: - python3-libnmstate state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - network_state is defined - ansible_distribution == 'Fedora' and diff --git a/tasks/set_facts.yml b/tasks/set_facts.yml index c1c7256..424a1a5 100644 --- a/tasks/set_facts.yml +++ b/tasks/set_facts.yml @@ -7,23 +7,17 @@ difference(ansible_facts.keys() | list) | length > 0 no_log: true -- name: Ensure correct package manager for ostree systems - vars: - ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree - ostree_booted_file: /run/ostree-booted - when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr +- name: Determine if system is ostree and set flag + when: not __network_is_ostree is defined block: - name: Check if system is ostree stat: - path: "{{ ostree_booted_file }}" + path: /run/ostree-booted register: __ostree_booted_stat - - name: Set package manager to use for ostree - ansible.utils.update_fact: - updates: - - path: ansible_facts.pkg_mgr - value: "{{ ostree_pkg_mgr }}" - when: __ostree_booted_stat.stat.exists + - name: Set flag to indicate system is ostree + set_fact: + __network_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" - name: Check which services are running service_facts: diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py index a75709c..95d4a06 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -21,6 +21,8 @@ GET_NM_VERSION = """ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/playbooks/integration_pytest_python3.yml b/tests/playbooks/integration_pytest_python3.yml index 499f7a7..cd17ca2 100644 --- a/tests/playbooks/integration_pytest_python3.yml +++ b/tests/playbooks/integration_pytest_python3.yml @@ -13,6 +13,8 @@ package: state: present name: "{{ rpmdependencies }}" + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Install Pytest command: "pip3 install pytest" @@ -151,6 +153,8 @@ package: name: network-scripts state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Run pytest with initscripts command: > pytest diff --git a/tests/playbooks/manual_test_ethtool_coalesce.yml b/tests/playbooks/manual_test_ethtool_coalesce.yml index 34291a6..2b58626 100644 --- a/tests/playbooks/manual_test_ethtool_coalesce.yml +++ b/tests/playbooks/manual_test_ethtool_coalesce.yml @@ -21,6 +21,8 @@ package: name: ethtool state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Test ethtool coalesce settings block: - name: >- diff --git a/tests/playbooks/tests_802_1x.yml b/tests/playbooks/tests_802_1x.yml index 85e3592..aa79ecf 100644 --- a/tests/playbooks/tests_802_1x.yml +++ b/tests/playbooks/tests_802_1x.yml @@ -42,6 +42,8 @@ package: name: iputils state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: "TEST: I can ping the EAP server" command: ping -c1 203.0.113.1 changed_when: false diff --git a/tests/playbooks/tests_802_1x_updated.yml b/tests/playbooks/tests_802_1x_updated.yml index 6ae3ac3..18c964c 100644 --- a/tests/playbooks/tests_802_1x_updated.yml +++ b/tests/playbooks/tests_802_1x_updated.yml @@ -8,6 +8,8 @@ package: name: NetworkManager state: latest # noqa package-latest + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Restart NetworkManager service: name: NetworkManager diff --git a/tests/playbooks/tests_checkpoint_cleanup.yml b/tests/playbooks/tests_checkpoint_cleanup.yml index 0baff35..6c93b08 100644 --- a/tests/playbooks/tests_checkpoint_cleanup.yml +++ b/tests/playbooks/tests_checkpoint_cleanup.yml @@ -28,6 +28,8 @@ package: name: dbus-tools state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" # create test profile - name: Include network role include_role: diff --git a/tests/playbooks/tests_ethtool_coalesce.yml b/tests/playbooks/tests_ethtool_coalesce.yml index 869011a..b97063f 100644 --- a/tests/playbooks/tests_ethtool_coalesce.yml +++ b/tests/playbooks/tests_ethtool_coalesce.yml @@ -27,6 +27,8 @@ package: name: ethtool state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Test ethtool coalesce settings block: diff --git a/tests/playbooks/tests_ethtool_features.yml b/tests/playbooks/tests_ethtool_features.yml index 9bc525a..897476f 100644 --- a/tests/playbooks/tests_ethtool_features.yml +++ b/tests/playbooks/tests_ethtool_features.yml @@ -27,6 +27,8 @@ package: name: ethtool state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Test ethtool features settings diff --git a/tests/playbooks/tests_ethtool_ring.yml b/tests/playbooks/tests_ethtool_ring.yml index 3ed5692..e1c99ee 100644 --- a/tests/playbooks/tests_ethtool_ring.yml +++ b/tests/playbooks/tests_ethtool_ring.yml @@ -27,6 +27,8 @@ package: name: ethtool state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Test ethtool ring settings block: diff --git a/tests/playbooks/tests_ipv6.yml b/tests/playbooks/tests_ipv6.yml index 5a7a088..7488a29 100644 --- a/tests/playbooks/tests_ipv6.yml +++ b/tests/playbooks/tests_ipv6.yml @@ -83,6 +83,8 @@ package: name: iputils state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Test gateway can be pinged command: ping6 -c1 2001:db8::1 when: diff --git a/tests/playbooks/tests_network_state.yml b/tests/playbooks/tests_network_state.yml index c8666dc..69df631 100644 --- a/tests/playbooks/tests_network_state.yml +++ b/tests/playbooks/tests_network_state.yml @@ -145,6 +145,8 @@ package: name: systemd-resolved state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - ansible_distribution_major_version | int > 8 diff --git a/tests/playbooks/tests_team_plugin_installation.yml b/tests/playbooks/tests_team_plugin_installation.yml index a01541c..ebab201 100644 --- a/tests/playbooks/tests_team_plugin_installation.yml +++ b/tests/playbooks/tests_team_plugin_installation.yml @@ -5,7 +5,7 @@ tasks: - name: Check if rpm ostree system - cannot test meta: end_host - when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree" + when: __network_is_ostree | d(false) - name: Remove the NetworkManager-team package package: diff --git a/tests/playbooks/tests_wireless_plugin_installation.yml b/tests/playbooks/tests_wireless_plugin_installation.yml index d353060..16ebe5b 100644 --- a/tests/playbooks/tests_wireless_plugin_installation.yml +++ b/tests/playbooks/tests_wireless_plugin_installation.yml @@ -5,7 +5,7 @@ tasks: - name: Check if rpm ostree system - cannot test meta: end_host - when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree" + when: __network_is_ostree | d(false) - name: Remove the NetworkManager-wifi package package: diff --git a/tests/tasks/create_test_interfaces_with_dhcp.yml b/tests/tasks/create_test_interfaces_with_dhcp.yml index 0ff326e..98f5061 100644 --- a/tests/tasks/create_test_interfaces_with_dhcp.yml +++ b/tests/tasks/create_test_interfaces_with_dhcp.yml @@ -4,11 +4,15 @@ package: name: dnsmasq state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Install pgrep, sysctl package: name: procps state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - ansible_os_family == 'RedHat' - ansible_distribution_major_version is version('6', '<=') @@ -17,6 +21,8 @@ package: name: procps-ng state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - ansible_os_family == 'RedHat' - ansible_distribution_major_version is version('7', '>=') diff --git a/tests/tasks/el_repo_setup.yml b/tests/tasks/el_repo_setup.yml index 9af3cd9..bd37c32 100644 --- a/tests/tasks/el_repo_setup.yml +++ b/tests/tasks/el_repo_setup.yml @@ -13,23 +13,17 @@ - distribution_version - os_family -- name: Ensure correct package manager for ostree systems - vars: - ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree - ostree_booted_file: /run/ostree-booted - when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr +- name: Determine if system is ostree and set flag + when: not __network_is_ostree is defined block: - name: Check if system is ostree stat: - path: "{{ ostree_booted_file }}" + path: /run/ostree-booted register: __ostree_booted_stat - - name: Set package manager to use for ostree - ansible.utils.update_fact: - updates: - - path: ansible_facts.pkg_mgr - value: "{{ ostree_pkg_mgr }}" - when: __ostree_booted_stat.stat.exists + - name: Set flag to indicate system is ostree + set_fact: + __network_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" - name: Fix CentOS6 Base repo copy: @@ -58,4 +52,4 @@ - ansible_distribution_major_version == '6' - name: Include the task 'enable_epel.yml' include_tasks: enable_epel.yml - when: ansible_facts["pkg_mgr"] != "ansible.posix.rhel_rpm_ostree" + when: not __network_is_ostree | d(false) diff --git a/tests/tasks/manage_test_interface.yml b/tests/tasks/manage_test_interface.yml index 56b4181..e4352e8 100644 --- a/tests/tasks/manage_test_interface.yml +++ b/tests/tasks/manage_test_interface.yml @@ -17,6 +17,8 @@ package: name: iproute state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" # veth - name: Create veth interface {{ interface }} diff --git a/tests/tasks/setup_802_1x_server.yml b/tests/tasks/setup_802_1x_server.yml index 772fdf8..a994965 100644 --- a/tests/tasks/setup_802_1x_server.yml +++ b/tests/tasks/setup_802_1x_server.yml @@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause --- +- name: Debug + debug: + msg: facts {{ ansible_facts | to_nice_json }} + # This task can be removed once the RHEL-8.5 is not tested anymore - name: Install hostapd via CentOS Stream command: dnf -y install http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/hostapd-2.10-1.el8.x86_64.rpm # noqa yaml[line-length] when: - - ansible_distribution_version | float < 8.6 + - ansible_distribution_version is version('8.6', '<') - ansible_distribution_major_version == '8' - ansible_distribution == 'RedHat' changed_when: false @@ -13,6 +17,8 @@ package: name: hostapd state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Create directory for test certificates file: diff --git a/tests/tasks/setup_mock_wifi.yml b/tests/tasks/setup_mock_wifi.yml index 7a4c5b0..e8d7abc 100644 --- a/tests/tasks/setup_mock_wifi.yml +++ b/tests/tasks/setup_mock_wifi.yml @@ -7,6 +7,8 @@ - NetworkManager - wpa_supplicant state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Ensure NetworkManager is running service: diff --git a/tests/tasks/setup_mock_wifi_wpa3_owe.yml b/tests/tasks/setup_mock_wifi_wpa3_owe.yml index 719d290..665a705 100644 --- a/tests/tasks/setup_mock_wifi_wpa3_owe.yml +++ b/tests/tasks/setup_mock_wifi_wpa3_owe.yml @@ -6,6 +6,8 @@ - NetworkManager - wpa_supplicant state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Check if can test on CentOS 8 and setup if possible when: @@ -16,7 +18,7 @@ # if using rpm ostree - so just skip this test - name: Check if rpm ostree system - cannot test meta: end_host - when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree" + when: __network_is_ostree | d(false) # yamllint disable rule:line-length # Even though hostapd can be installed via EPEL 8, Opportunistic Wireless Encryption diff --git a/tests/tasks/setup_mock_wifi_wpa3_sae.yml b/tests/tasks/setup_mock_wifi_wpa3_sae.yml index 4f6a44e..3b6ffac 100644 --- a/tests/tasks/setup_mock_wifi_wpa3_sae.yml +++ b/tests/tasks/setup_mock_wifi_wpa3_sae.yml @@ -6,6 +6,8 @@ - NetworkManager - wpa_supplicant state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Configure CentOS 8 system for testing, if possible when: @@ -16,7 +18,7 @@ # if using rpm ostree - so just skip this test - name: Check if rpm ostree system - cannot test meta: end_host - when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree" + when: __network_is_ostree | d(false) # yamllint disable rule:line-length # Even though hostapd can be installed via EPEL 8, Simultaneous Authentication diff --git a/tests/tasks/test_802.1x_capath.yml b/tests/tasks/test_802.1x_capath.yml index 4de4a92..de57765 100644 --- a/tests/tasks/test_802.1x_capath.yml +++ b/tests/tasks/test_802.1x_capath.yml @@ -33,6 +33,8 @@ package: name: openssl state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Hash cacert command: openssl x509 -hash -noout -in /etc/pki/tls/my_ca_certs/cacert.pem @@ -77,6 +79,8 @@ package: name: iputils state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: "TEST: I can ping the EAP server" command: ping -c1 203.0.113.1 changed_when: false diff --git a/tests/tests_change_indication_on_repeat_run.yml b/tests/tests_change_indication_on_repeat_run.yml index 8b29f27..62c9312 100644 --- a/tests/tests_change_indication_on_repeat_run.yml +++ b/tests/tests_change_indication_on_repeat_run.yml @@ -7,23 +7,17 @@ type: veth name: Test change indication on repeat run tasks: - - name: Ensure correct package manager for ostree systems - vars: - ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree - ostree_booted_file: /run/ostree-booted - when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr + - name: Determine if system is ostree and set flag + when: not __network_is_ostree is defined block: - name: Check if system is ostree stat: - path: "{{ ostree_booted_file }}" + path: /run/ostree-booted register: __ostree_booted_stat - - name: Set package manager to use for ostree - ansible.utils.update_fact: - updates: - - path: ansible_facts.pkg_mgr - value: "{{ ostree_pkg_mgr }}" - when: __ostree_booted_stat.stat.exists + - name: Set flag to indicate system is ostree + set_fact: + __network_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" - name: Include the task 'manage_test_interface.yml' include_tasks: tasks/manage_test_interface.yml vars: diff --git a/tests/tests_eth_pci_address_match_nm.yml b/tests/tests_eth_pci_address_match_nm.yml index 73eef13..84f0247 100644 --- a/tests/tests_eth_pci_address_match_nm.yml +++ b/tests/tests_eth_pci_address_match_nm.yml @@ -24,6 +24,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_ethtool_coalesce_nm.yml b/tests/tests_ethtool_coalesce_nm.yml index 1c0146d..dd37ad0 100644 --- a/tests/tests_ethtool_coalesce_nm.yml +++ b/tests/tests_ethtool_coalesce_nm.yml @@ -24,6 +24,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_ethtool_features_nm.yml b/tests/tests_ethtool_features_nm.yml index 84fae71..42d78c0 100644 --- a/tests/tests_ethtool_features_nm.yml +++ b/tests/tests_ethtool_features_nm.yml @@ -24,6 +24,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_ethtool_ring_nm.yml b/tests/tests_ethtool_ring_nm.yml index bfe1c35..27df87d 100644 --- a/tests/tests_ethtool_ring_nm.yml +++ b/tests/tests_ethtool_ring_nm.yml @@ -24,6 +24,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_provider_nm.yml b/tests/tests_provider_nm.yml index 53960f6..5a4ee1a 100644 --- a/tests/tests_provider_nm.yml +++ b/tests/tests_provider_nm.yml @@ -24,6 +24,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_regression_nm.yml b/tests/tests_regression_nm.yml index 08162f2..04bc1fa 100644 --- a/tests/tests_regression_nm.yml +++ b/tests/tests_regression_nm.yml @@ -15,6 +15,8 @@ package: name: NetworkManager state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Get package info package_facts: - name: Get NetworkManager version diff --git a/tests/tests_unit.yml b/tests/tests_unit.yml index 47f8cf4..1f29665 100644 --- a/tests/tests_unit.yml +++ b/tests/tests_unit.yml @@ -10,6 +10,8 @@ package: name: "{{ item }}" state: present + use: "{{ (__network_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" # Ignore error because some package names might not be available ignore_errors: true # noqa ignore-errors loop: