From 39ac91d9af10c1a8b87e49bb71ce2707ceeb4bba Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 7 Jan 2026 14:10:00 -0700 Subject: [PATCH] refactor: handle INJECT_FACTS_AS_VARS=false by using ansible_facts instead Ansible 2.20 has deprecated the use of Ansible facts as variables. For example, `ansible_distribution` is now deprecated in favor of `ansible_facts["distribution"]`. This is due to making the default setting `INJECT_FACTS_AS_VARS=false`. For now, this will create WARNING messages, but in Ansible 2.24 it will be an error. See https://docs.ansible.com/projects/ansible/latest/porting_guides/porting_guide_core_2.20.html#inject-facts-as-vars Signed-off-by: Rich Megginson --- defaults/main.yml | 22 ++++----- tasks/main.yml | 30 ++++++------ tests/ensure_provider_tests.py | 48 +++++++++---------- tests/playbooks/tests_ethernet.yml | 8 ++-- tests/playbooks/tests_ipv6.yml | 6 +-- tests/playbooks/tests_ipv6_dns_search.yml | 6 +-- tests/playbooks/tests_routing_rules.yml | 18 +++---- tests/playbooks/tests_wireless_wpa3_sae.yml | 4 +- .../create_test_interfaces_with_dhcp.yml | 8 ++-- tests/tasks/el_repo_setup.yml | 4 +- tests/tasks/setup_802_1x_server.yml | 6 +-- tests/tasks/setup_mock_wifi_wpa3_owe.yml | 6 +-- tests/tasks/setup_mock_wifi_wpa3_sae.yml | 6 +-- tests/tests_802_1x_nm.yml | 8 ++-- tests/tests_802_1x_updated_nm.yml | 8 ++-- tests/tests_auto_gateway_initscripts.yml | 4 +- tests/tests_auto_gateway_nm.yml | 2 +- tests/tests_bond_cloned_mac_initscripts.yml | 4 +- tests/tests_bond_cloned_mac_nm.yml | 2 +- tests/tests_bond_deprecated_initscripts.yml | 4 +- tests/tests_bond_deprecated_nm.yml | 2 +- tests/tests_bond_initscripts.yml | 4 +- tests/tests_bond_nm.yml | 2 +- tests/tests_bond_options_nm.yml | 2 +- tests/tests_bond_port_match_by_mac_nm.yml | 2 +- tests/tests_bond_removal_initscripts.yml | 4 +- tests/tests_bond_removal_nm.yml | 2 +- tests/tests_bridge_cloned_mac_initscripts.yml | 4 +- tests/tests_bridge_cloned_mac_nm.yml | 2 +- tests/tests_bridge_initscripts.yml | 4 +- tests/tests_bridge_nm.yml | 2 +- tests/tests_default_initscripts.yml | 4 +- tests/tests_default_nm.yml | 2 +- tests/tests_dummy_nm.yml | 2 +- tests/tests_eth_dns_support_nm.yml | 2 +- tests/tests_eth_pci_address_match_nm.yml | 4 +- tests/tests_ethernet_initscripts.yml | 4 +- tests/tests_ethernet_nm.yml | 2 +- tests/tests_ethtool_coalesce_initscripts.yml | 4 +- tests/tests_ethtool_coalesce_nm.yml | 4 +- tests/tests_ethtool_features_initscripts.yml | 4 +- tests/tests_ethtool_features_nm.yml | 4 +- tests/tests_ethtool_ring_initscripts.yml | 4 +- tests/tests_ethtool_ring_nm.yml | 4 +- tests/tests_helpers_and_asserts.yml | 2 +- tests/tests_ignore_auto_dns_nm.yml | 2 +- tests/tests_infiniband_nm.yml | 2 +- tests/tests_integration_pytest.yml | 8 ++-- tests/tests_ipv6_disabled_nm.yml | 2 +- tests/tests_ipv6_dns_search_nm.yml | 2 +- tests/tests_ipv6_initscripts.yml | 4 +- tests/tests_ipv6_nm.yml | 2 +- tests/tests_mac_address_match_nm.yml | 4 +- tests/tests_network_state_nm.yml | 4 +- tests/tests_provider_nm.yml | 12 ++--- tests/tests_reapply_nm.yml | 2 +- tests/tests_regression_nm.yml | 10 ++-- tests/tests_route_device_initscripts.yml | 4 +- tests/tests_route_device_nm.yml | 2 +- tests/tests_route_table_nm.yml | 2 +- tests/tests_route_type_nm.yml | 4 +- tests/tests_routing_rules_nm.yml | 2 +- tests/tests_states_initscripts.yml | 4 +- tests/tests_states_nm.yml | 2 +- tests/tests_switch_provider.yml | 4 +- tests/tests_team_nm.yml | 6 +-- tests/tests_team_plugin_installation_nm.yml | 6 +-- tests/tests_unit.yml | 2 +- tests/tests_vlan_mtu_initscripts.yml | 4 +- tests/tests_vlan_mtu_nm.yml | 2 +- .../tests_wireless_and_network_restart_nm.yml | 2 +- tests/tests_wireless_nm.yml | 4 +- .../tests_wireless_plugin_installation_nm.yml | 2 +- tests/tests_wireless_wpa3_owe_nm.yml | 6 +-- tests/tests_wireless_wpa3_sae_nm.yml | 4 +- tests/vars/rh_distros_vars.yml | 4 +- 76 files changed, 199 insertions(+), 201 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 370c84b..467a030 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,16 +19,16 @@ __network_rh_distros: __network_rh_distros_fedora: "{{ __network_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__network_is_rh_distro: "{{ ansible_distribution in __network_rh_distros }}" +__network_is_rh_distro: "{{ ansible_facts['distribution'] in __network_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__network_is_rh_distro_fedora: "{{ ansible_distribution in __network_rh_distros_fedora }}" +__network_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __network_rh_distros_fedora }}" # END - DO NOT EDIT THIS BLOCK - rh distros variables # Use initscripts for RHEL/CentOS < 7, nm otherwise network_provider_os_default: "{{ - 'initscripts' if ansible_distribution in __network_rh_distros and - ansible_distribution_major_version is version('7', '<') + 'initscripts' if ansible_facts['distribution'] in __network_rh_distros and + ansible_facts['distribution_major_version'] is version('7', '<') else 'nm' }}" # If NetworkManager.service is running, assume that 'nm' is currently in-use, # otherwise initscripts @@ -76,7 +76,7 @@ __network_packages_default_wpa_supplicant: ["{% # - python-gobject-base on RHEL7 (no python2-gobject-base :-/) # - python3-gobject-base on Fedora 28+ __network_packages_default_gobject_packages: ["python{{ - ansible_python['version']['major'] | replace('2', '') }}-gobject-base"] + ansible_facts['python']['version']['major'] | replace('2', '') }}-gobject-base"] __network_service_name_default_nm: NetworkManager __network_packages_default_nm: "{{ ['NetworkManager'] @@ -92,18 +92,18 @@ __network_service_name_default_initscripts: network __network_packages_default_initscripts_bridge: ["{% if network_connections | selectattr('type', 'defined') | selectattr('type', 'match', '^bridge$') | list | count > 0 and - ansible_distribution in __network_rh_distros and - ansible_distribution_major_version is version('7', '<=') + ansible_facts['distribution'] in __network_rh_distros and + ansible_facts['distribution_major_version'] is version('7', '<=') %}bridge-utils{% endif %}"] __network_packages_default_initscripts_network_scripts: ["{% -if ansible_distribution in __network_rh_distros and - ansible_distribution_major_version is version('7', '<=') +if ansible_facts['distribution'] in __network_rh_distros and + ansible_facts['distribution_major_version'] is version('7', '<=') %}initscripts{% else %}network-scripts{% endif %}"] # Initscripts provider requires `/sbin/dhclient` to obtain DHCP address, # which is provided by the dhcp client package __network_packages_default_initscripts_dhcp_client: ["{% -if ansible_distribution in __network_rh_distros and - ansible_distribution_major_version is version('7', '<=') +if ansible_facts['distribution'] in __network_rh_distros and + ansible_facts['distribution_major_version'] is version('7', '<=') %}dhclient{% else %}dhcp-client{% endif %}"] # convert _network_packages_default_initscripts_bridge to an empty list if it # contains only the empty string and add it to the default package list diff --git a/tasks/main.yml b/tasks/main.yml index 070eeef..8079dd7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -23,18 +23,18 @@ supported since RHEL-8 when: - network_state != {} - - ansible_distribution_major_version | int < 8 + - ansible_facts["distribution_major_version"] | int < 8 - name: Abort applying teaming configuration if the system version of the managed host is EL10 or later fail: msg: >- Teaming is not supported in - {{ ansible_distribution }}-{{ ansible_distribution_major_version }} - + {{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }} - use bonding instead when: - - ansible_distribution_major_version | int > 9 - - ansible_distribution in __network_rh_distros + - ansible_facts["distribution_major_version"] | int > 9 + - ansible_facts["distribution"] in __network_rh_distros - network_connections | selectattr("type", "defined") | selectattr("type", "match", "^team$") | list | length > 0 or network_state.get("interfaces", []) | selectattr("type", "defined") | @@ -49,8 +49,8 @@ register: dnf_package_update_info check_mode: true when: - - ansible_distribution == 'Fedora' or - ansible_distribution_major_version | int > 7 + - ansible_facts["distribution"] == 'Fedora' or + ansible_facts["distribution_major_version"] | int > 7 - __network_wireless_connections_defined or __network_team_connections_defined - not __network_is_ostree @@ -64,7 +64,7 @@ register: yum_package_update_info check_mode: true when: - - ansible_distribution_major_version | int < 8 + - ansible_facts["distribution_major_version"] | int < 8 - __network_wireless_connections_defined or __network_team_connections_defined - not __network_is_ostree @@ -112,10 +112,10 @@ ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - network_state != {} - - ansible_distribution == 'Fedora' and - ansible_distribution_major_version | int > 27 or - ansible_distribution != 'Fedora' and - ansible_distribution_major_version | int > 7 + - ansible_facts["distribution"] == 'Fedora' and + ansible_facts["distribution_major_version"] | int > 27 or + ansible_facts["distribution"] != 'Fedora' and + ansible_facts["distribution_major_version"] | int > 7 - name: Install python3-libnmstate when using network_state variable package: @@ -126,10 +126,10 @@ ternary('ansible.posix.rhel_rpm_ostree', omit) }}" when: - network_state != {} - - ansible_distribution == 'Fedora' and - ansible_distribution_major_version | int > 34 or - ansible_distribution != 'Fedora' and - ansible_distribution_major_version | int > 8 + - ansible_facts["distribution"] == 'Fedora' and + ansible_facts["distribution_major_version"] | int > 34 or + ansible_facts["distribution"] != 'Fedora' and + ansible_facts["distribution_major_version"] | int > 8 # If network packages changed and wireless or team connections are specified, # NetworkManager must be restarted, and the user needs to explicitly consent diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py index c01ff39..3f9a609 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -12,7 +12,7 @@ import sys GET_NM_VERSION = """ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -58,7 +58,7 @@ RUN_PLAYBOOK_WITH_NM = """# SPDX-License-Identifier: BSD-3-Clause {comment}- name: Import the playbook '{test_playbook}' import_playbook: {test_playbook} when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' {minimum_nm_version_check}{extra_run_condition}""" MINIMUM_VERSION = "minimum_version" @@ -66,16 +66,16 @@ EXTRA_RUN_CONDITION = "extra_run_condition" NM_ONLY_TESTS = { "playbooks/tests_802_1x_updated.yml": { EXTRA_RUN_CONDITION: ( - "(ansible_distribution != 'RedHat' and\n" - " ansible_distribution_major_version | int > 7) or\n" - " ansible_distribution_major_version | int == 8" + "(ansible_facts['distribution'] != 'RedHat' and\n" + " ansible_facts['distribution_major_version'] | int > 7) or\n" + " ansible_facts['distribution_major_version'] | int == 8" ), }, "playbooks/tests_802_1x.yml": { EXTRA_RUN_CONDITION: ( - "(ansible_distribution != 'RedHat' and\n" - " ansible_distribution_major_version | int > 7) or\n" - " ansible_distribution_major_version | int == 8" + "(ansible_facts['distribution'] != 'RedHat' and\n" + " ansible_facts['distribution_major_version'] | int > 7) or\n" + " ansible_facts['distribution_major_version'] | int == 8" ), }, "playbooks/tests_ignore_auto_dns.yml": {}, @@ -94,10 +94,10 @@ NM_ONLY_TESTS = { MINIMUM_VERSION: "'1.20.0'", "comment": "# NetworKmanager 1.20.0 added support for forgetting profiles", EXTRA_RUN_CONDITION: ( - "(ansible_distribution == 'Fedora'\n" - " and ansible_distribution_major_version | int < 41)\n" - " or ansible_distribution not in ['RedHat', 'CentOS', 'Fedora']\n" - " or ansible_distribution_major_version | int < 9" + "(ansible_facts['distribution'] == 'Fedora'\n" + " and ansible_facts['distribution_major_version'] | int < 41)\n" + " or ansible_facts['distribution'] not in ['RedHat', 'CentOS', 'Fedora']\n" + " or ansible_facts['distribution_major_version'] | int < 9" ), }, "playbooks/tests_eth_pci_address_match.yml": { @@ -105,7 +105,7 @@ NM_ONLY_TESTS = { "comment": "# NetworkManager 1.26.0 added support for match.path setting", }, "playbooks/tests_network_state.yml": { - EXTRA_RUN_CONDITION: "ansible_distribution_major_version | int > 7", + EXTRA_RUN_CONDITION: "ansible_facts['distribution_major_version'] | int > 7", }, "playbooks/tests_reapply.yml": {}, "playbooks/tests_route_table.yml": {}, @@ -117,32 +117,30 @@ blackhole, prohibit and unreachable", "playbooks/tests_routing_rules.yml": {}, # teaming support dropped in EL10 "playbooks/tests_team.yml": { - EXTRA_RUN_CONDITION: "ansible_distribution not in ['RedHat', 'CentOS'] or\n ansible_distr\ -ibution_major_version | int < 10", + EXTRA_RUN_CONDITION: "ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or\n ansible_facts['distribution_major_version'] | int < 10", }, "playbooks/tests_team_plugin_installation.yml": { - EXTRA_RUN_CONDITION: "ansible_distribution not in ['RedHat', 'CentOS'] or\n ansible_distr\ -ibution_major_version | int < 10", + EXTRA_RUN_CONDITION: "ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or\n ansible_facts['distribution_major_version'] | int < 10", }, # mac80211_hwsim (used for tests_wireless) only seems to be available # and working on RHEL/CentOS 7 "playbooks/tests_wireless.yml": { - EXTRA_RUN_CONDITION: "ansible_distribution_major_version == '7'", + EXTRA_RUN_CONDITION: "ansible_facts['distribution_major_version'] == '7'", }, "playbooks/tests_wireless_and_network_restart.yml": {}, "playbooks/tests_wireless_plugin_installation.yml": {}, "playbooks/tests_wireless_wpa3_owe.yml": { "comment": "# OWE has not been supported by NetworkManager 1.18.8 on \ RHEL 7(dist-tag). Failed in setting up mock wifi on RHEL 8", - EXTRA_RUN_CONDITION: "ansible_distribution_major_version > '7' and \ -ansible_distribution == 'CentOS' or\n ansible_distribution_major_version > '32' \ -and ansible_distribution == 'Fedora'", + EXTRA_RUN_CONDITION: "ansible_facts['distribution_major_version'] > '7' and \ +ansible_facts['distribution'] == 'CentOS' or\n ansible_facts['distribution_major_version'] > '32' \ +and ansible_facts['distribution'] == 'Fedora'", }, "playbooks/tests_wireless_wpa3_sae.yml": { "comment": "# SAE has not been supported by NetworkManager 1.18.8 on \ RHEL 7. Failed in setting up mock wifi on RHEL 8", - EXTRA_RUN_CONDITION: "ansible_distribution_major_version != '7' and \ -ansible_distribution != 'RedHat'", + EXTRA_RUN_CONDITION: "ansible_facts['distribution_major_version'] != '7' and \ +ansible_facts['distribution'] != 'RedHat'", }, } # NM_CONDITIONAL_TESTS is used to store the test playbooks which are demanding for NM @@ -187,8 +185,8 @@ RUN_PLAYBOOK_WITH_INITSCRIPTS = """# SPDX-License-Identifier: BSD-3-Clause - name: Import the playbook '{test_playbook}' import_playbook: {test_playbook} - when: (ansible_distribution in ['CentOS','RedHat'] and\n \ -ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and\n \ +ansible_facts['distribution_major_version'] | int < 9) """ diff --git a/tests/playbooks/tests_ethernet.yml b/tests/playbooks/tests_ethernet.yml index 4c1e895..e0b636e 100644 --- a/tests/playbooks/tests_ethernet.yml +++ b/tests/playbooks/tests_ethernet.yml @@ -52,7 +52,7 @@ when: - network_provider == 'nm' # RHEL up to 8 uses initscripts backend - - ansible_distribution_major_version | int >= 9 + - ansible_facts["distribution_major_version"] | int >= 9 - name: Assert settings in NM connection file assert: @@ -64,7 +64,7 @@ when: - network_provider == 'nm' # RHEL up to 8 uses initscripts backend - - ansible_distribution_major_version | int >= 9 + - ansible_facts["distribution_major_version"] | int >= 9 - name: Get NM connection status command: "nmcli connection show {{ interface }}" @@ -82,7 +82,7 @@ slurp: src: "/etc/sysconfig/network-scripts/ifcfg-{{ interface }}" register: initscripts_connection_file - when: network_provider == 'initscripts' or ansible_distribution_major_version | int < 9 + when: network_provider == 'initscripts' or ansible_facts["distribution_major_version"] | int < 9 - name: Assert settings in initscripts connection file assert: @@ -91,7 +91,7 @@ - "'DEVICE={{ interface }}' in initscripts_connection_file.content | b64decode" - "'IPADDR=192.0.2.1' in initscripts_connection_file.content | b64decode" - "'PREFIX=24' in initscripts_connection_file.content | b64decode" - when: network_provider == 'initscripts' or ansible_distribution_major_version | int < 9 + when: network_provider == 'initscripts' or ansible_facts["distribution_major_version"] | int < 9 - name: Include the tasks 'down_profile+delete_interface.yml' include_tasks: tasks/down_profile+delete_interface.yml diff --git a/tests/playbooks/tests_ipv6.yml b/tests/playbooks/tests_ipv6.yml index ab11f40..1e653a7 100644 --- a/tests/playbooks/tests_ipv6.yml +++ b/tests/playbooks/tests_ipv6.yml @@ -20,7 +20,7 @@ ip netns exec ns1 ip link set peer{{ interface }} up when: # netns not available on RHEL/CentOS 6 - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' changed_when: false - name: Test IPv6 config block: @@ -87,7 +87,7 @@ - name: Test gateway can be pinged command: ping6 -c1 2001:db8::1 when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' changed_when: false always: - name: "TEARDOWN: remove profiles." @@ -109,7 +109,7 @@ - name: Clean up namespace command: ip netns delete ns1 when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' changed_when: false - name: Verify network state restored to default include_tasks: tasks/check_network_dns.yml diff --git a/tests/playbooks/tests_ipv6_dns_search.yml b/tests/playbooks/tests_ipv6_dns_search.yml index b5828a1..2f7c7f7 100644 --- a/tests/playbooks/tests_ipv6_dns_search.yml +++ b/tests/playbooks/tests_ipv6_dns_search.yml @@ -126,14 +126,14 @@ state: up ignore_errors: true # noqa ignore-errors changed_when: false - when: ansible_distribution_major_version | int > 7 + when: ansible_facts["distribution_major_version"] | int > 7 - name: Assert that reconfiguring network connection is failed assert: that: - __network_connections_result.failed msg: reconfiguring network connection is not failed - when: ansible_distribution_major_version | int > 7 + when: ansible_facts["distribution_major_version"] | int > 7 - name: Assert that configuring DNS search setting is not allowed when both IPv4 and IPv6 are disabled @@ -145,7 +145,7 @@ msg: Reconfiguring network connection is not failed with the error "Setting 'dns_search', 'dns_options', and 'dns_priority' are not allowed when both IPv4 and IPv6 are disabled." - when: ansible_distribution_major_version | int > 7 + when: ansible_facts["distribution_major_version"] | int > 7 always: - name: Clean up the test device and the connection profile diff --git a/tests/playbooks/tests_routing_rules.yml b/tests/playbooks/tests_routing_rules.yml index 1495bbd..7bb3034 100644 --- a/tests/playbooks/tests_routing_rules.yml +++ b/tests/playbooks/tests_routing_rules.yml @@ -141,7 +141,7 @@ until NM 1.20") msg: The routing rule attribute 'suppress_prefixlength' validation failure is not raised when the distro's major version is 7 - when: ansible_distribution_major_version == "7" + when: ansible_facts['distribution_major_version'] == "7" - name: Clear errors meta: clear_host_errors @@ -161,28 +161,28 @@ register: route_rule_table_30200 ignore_errors: true changed_when: false - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Get the routing rule for looking up the table 30400 command: ip rule list table 30400 register: route_rule_table_30400 ignore_errors: true changed_when: false - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Get the routing rule for looking up the table 30600 command: ip -6 rule list table 30600 register: route_rule_table_30600 ignore_errors: true changed_when: false - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Get the routing rule for looking up the table 'custom' command: ip rule list table custom register: route_rule_table_custom ignore_errors: true changed_when: false - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Get the IPv4 routing rule for the connection "{{ interface }}" command: nmcli -f ipv4.routing-rules c show "{{ interface }}" @@ -216,7 +216,7 @@ 30200 suppress_prefixlength 8") msg: "the routing rule with table lookup 30200 does not match the specified rule" - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Assert that the routing rule with table lookup 30400 matches the specified rule @@ -230,7 +230,7 @@ oiftest \[detached\] lookup 30400") msg: "the routing rule with table lookup 30400 does not match the specified rule" - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Assert that the routing rule with table lookup 30600 matches the specified rule @@ -246,7 +246,7 @@ lookup 30600 suppress_prefixlength 24") msg: "the routing rule with table lookup 30600 does not match the specified rule" - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Assert that the routing rule with 'custom' table lookup matches the specified rule @@ -256,7 +256,7 @@ 198.51.100.56/26 lookup custom") msg: "the routing rule with 'custom' table lookup does not match the specified rule" - when: ansible_distribution_major_version != "7" + when: ansible_facts['distribution_major_version'] != "7" - name: Assert that the specified IPv4 routing rule was configured in the connection "{{ interface }}" diff --git a/tests/playbooks/tests_wireless_wpa3_sae.yml b/tests/playbooks/tests_wireless_wpa3_sae.yml index 7aad302..ba3fb14 100644 --- a/tests/playbooks/tests_wireless_wpa3_sae.yml +++ b/tests/playbooks/tests_wireless_wpa3_sae.yml @@ -7,7 +7,7 @@ tasks: - name: "INIT: wireless tests" include_tasks: tasks/setup_mock_wifi_wpa3_sae.yml - when: ansible_distribution in ['CentOS', 'Fedora'] + when: ansible_facts['distribution'] in ['CentOS', 'Fedora'] - name: Test wireless connection with WPA3 Personal block: @@ -20,7 +20,7 @@ - name: "{{ interface }}" # set `state: down` on RHEL 8 since we failed in setting up mock # wifi on RHEL 8 - state: "{{ 'down' if ansible_distribution == 'RedHat' else 'up' }}" + state: "{{ 'down' if ansible_facts['distribution'] == 'RedHat' else 'up' }}" type: wireless ip: address: diff --git a/tests/tasks/create_test_interfaces_with_dhcp.yml b/tests/tasks/create_test_interfaces_with_dhcp.yml index 28d8eef..0d2b187 100644 --- a/tests/tasks/create_test_interfaces_with_dhcp.yml +++ b/tests/tasks/create_test_interfaces_with_dhcp.yml @@ -22,8 +22,8 @@ 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', '<=') + - ansible_facts['os_family'] == 'RedHat' + - ansible_facts['distribution_major_version'] is version('6', '<=') - name: Install pgrep, sysctl package: @@ -32,8 +32,8 @@ 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', '>=') + - ansible_facts['os_family'] == 'RedHat' + - ansible_facts['distribution_major_version'] is version('7', '>=') - name: Create test interfaces shell: | diff --git a/tests/tasks/el_repo_setup.yml b/tests/tasks/el_repo_setup.yml index a492940..1f15d78 100644 --- a/tests/tasks/el_repo_setup.yml +++ b/tests/tasks/el_repo_setup.yml @@ -48,5 +48,5 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 mode: "0644" when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '6' + - ansible_facts['distribution'] == 'CentOS' + - ansible_facts['distribution_major_version'] == '6' diff --git a/tests/tasks/setup_802_1x_server.yml b/tests/tasks/setup_802_1x_server.yml index 0041a5a..550a29c 100644 --- a/tests/tasks/setup_802_1x_server.yml +++ b/tests/tasks/setup_802_1x_server.yml @@ -8,9 +8,9 @@ - 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 is version('8.6', '<') - - ansible_distribution_major_version == '8' - - ansible_distribution == 'RedHat' + - ansible_facts['distribution_version'] is version('8.6', '<') + - ansible_facts['distribution_major_version'] == '8' + - ansible_facts['distribution'] == 'RedHat' changed_when: false - name: Install hostapd diff --git a/tests/tasks/setup_mock_wifi_wpa3_owe.yml b/tests/tasks/setup_mock_wifi_wpa3_owe.yml index dce71c0..fac248c 100644 --- a/tests/tasks/setup_mock_wifi_wpa3_owe.yml +++ b/tests/tasks/setup_mock_wifi_wpa3_owe.yml @@ -14,7 +14,7 @@ delay: 10 - name: Check if can test on CentOS and setup if possible - when: ansible_distribution == 'CentOS' + when: ansible_facts['distribution'] == 'CentOS' block: # It is currently too difficult to install the required kernel # if using rpm ostree - so just skip this test @@ -48,7 +48,7 @@ dnf -y copr enable liangwen12year/hostapd-owe dnf -y install hostapd when: - - ansible_distribution == 'Fedora' + - ansible_facts['distribution'] == 'Fedora' changed_when: false - name: Install mac80211_hwsim kernel modules in Fedora @@ -57,7 +57,7 @@ koji download-build --arch=$(uname -m) kernel-modules-internal-$(uname -r) dnf -y install kernel-modules*.rpm when: - - ansible_distribution == 'Fedora' + - ansible_facts['distribution'] == 'Fedora' changed_when: false - name: Create hostapd config diff --git a/tests/tasks/setup_mock_wifi_wpa3_sae.yml b/tests/tasks/setup_mock_wifi_wpa3_sae.yml index 8da2722..ed64cef 100644 --- a/tests/tasks/setup_mock_wifi_wpa3_sae.yml +++ b/tests/tasks/setup_mock_wifi_wpa3_sae.yml @@ -14,7 +14,7 @@ delay: 10 - name: Configure CentOS system for testing, if possible - when: ansible_distribution == 'CentOS' + when: ansible_facts['distribution'] == 'CentOS' block: # It is currently too difficult to install the required kernel # if using rpm ostree - so just skip this test @@ -49,7 +49,7 @@ - hostapd state: present when: - - ansible_distribution == 'Fedora' + - ansible_facts['distribution'] == 'Fedora' register: __install_status until: __install_status is success retries: 6 @@ -64,7 +64,7 @@ koji download-build --arch=$(uname -m) kernel-modules-internal-$(uname -r) dnf -y install kernel-modules*.rpm when: - - ansible_distribution == 'Fedora' + - ansible_facts['distribution'] == 'Fedora' changed_when: false - name: Create hostapd config diff --git a/tests/tests_802_1x_nm.yml b/tests/tests_802_1x_nm.yml index 29baafa..36002de 100644 --- a/tests/tests_802_1x_nm.yml +++ b/tests/tests_802_1x_nm.yml @@ -20,7 +20,7 @@ - name: Import the playbook 'playbooks/tests_802_1x.yml' import_playbook: playbooks/tests_802_1x.yml when: - - ansible_distribution_major_version != '6' - - (ansible_distribution != 'RedHat' and - ansible_distribution_major_version | int > 7) or - ansible_distribution_major_version | int == 8 + - ansible_facts['distribution_major_version'] != '6' + - (ansible_facts['distribution'] != 'RedHat' and + ansible_facts['distribution_major_version'] | int > 7) or + ansible_facts['distribution_major_version'] | int == 8 diff --git a/tests/tests_802_1x_updated_nm.yml b/tests/tests_802_1x_updated_nm.yml index 8e9b45d..b11a4be 100644 --- a/tests/tests_802_1x_updated_nm.yml +++ b/tests/tests_802_1x_updated_nm.yml @@ -20,7 +20,7 @@ - name: Import the playbook 'playbooks/tests_802_1x_updated.yml' import_playbook: playbooks/tests_802_1x_updated.yml when: - - ansible_distribution_major_version != '6' - - (ansible_distribution != 'RedHat' and - ansible_distribution_major_version | int > 7) or - ansible_distribution_major_version | int == 8 + - ansible_facts['distribution_major_version'] != '6' + - (ansible_facts['distribution'] != 'RedHat' and + ansible_facts['distribution_major_version'] | int > 7) or + ansible_facts['distribution_major_version'] | int == 8 diff --git a/tests/tests_auto_gateway_initscripts.yml b/tests/tests_auto_gateway_initscripts.yml index 5309e2b..37d74e3 100644 --- a/tests/tests_auto_gateway_initscripts.yml +++ b/tests/tests_auto_gateway_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_auto_gateway.yml' import_playbook: playbooks/tests_auto_gateway.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_auto_gateway_nm.yml b/tests/tests_auto_gateway_nm.yml index 2be588d..14ad4b1 100644 --- a/tests/tests_auto_gateway_nm.yml +++ b/tests/tests_auto_gateway_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_auto_gateway.yml' import_playbook: playbooks/tests_auto_gateway.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_cloned_mac_initscripts.yml b/tests/tests_bond_cloned_mac_initscripts.yml index 582aeb1..45b9c36 100644 --- a/tests/tests_bond_cloned_mac_initscripts.yml +++ b/tests/tests_bond_cloned_mac_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bond_cloned_mac.yml' import_playbook: playbooks/tests_bond_cloned_mac.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bond_cloned_mac_nm.yml b/tests/tests_bond_cloned_mac_nm.yml index 01af653..57bf5e3 100644 --- a/tests/tests_bond_cloned_mac_nm.yml +++ b/tests/tests_bond_cloned_mac_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond_cloned_mac.yml' import_playbook: playbooks/tests_bond_cloned_mac.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_deprecated_initscripts.yml b/tests/tests_bond_deprecated_initscripts.yml index 85c5e64..2519d38 100644 --- a/tests/tests_bond_deprecated_initscripts.yml +++ b/tests/tests_bond_deprecated_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bond_deprecated.yml' import_playbook: playbooks/tests_bond_deprecated.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bond_deprecated_nm.yml b/tests/tests_bond_deprecated_nm.yml index 25d2f92..0cd7148 100644 --- a/tests/tests_bond_deprecated_nm.yml +++ b/tests/tests_bond_deprecated_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond_deprecated.yml' import_playbook: playbooks/tests_bond_deprecated.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_initscripts.yml b/tests/tests_bond_initscripts.yml index 935d98e..b2915e0 100644 --- a/tests/tests_bond_initscripts.yml +++ b/tests/tests_bond_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bond.yml' import_playbook: playbooks/tests_bond.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bond_nm.yml b/tests/tests_bond_nm.yml index d4b1a1b..1541f79 100644 --- a/tests/tests_bond_nm.yml +++ b/tests/tests_bond_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond.yml' import_playbook: playbooks/tests_bond.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_options_nm.yml b/tests/tests_bond_options_nm.yml index b59c7c1..95dbd20 100644 --- a/tests/tests_bond_options_nm.yml +++ b/tests/tests_bond_options_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond_options.yml' import_playbook: playbooks/tests_bond_options.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_port_match_by_mac_nm.yml b/tests/tests_bond_port_match_by_mac_nm.yml index 399a506..fac5f73 100644 --- a/tests/tests_bond_port_match_by_mac_nm.yml +++ b/tests/tests_bond_port_match_by_mac_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond_port_match_by_mac.yml' import_playbook: playbooks/tests_bond_port_match_by_mac.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bond_removal_initscripts.yml b/tests/tests_bond_removal_initscripts.yml index 176ca95..c565d7f 100644 --- a/tests/tests_bond_removal_initscripts.yml +++ b/tests/tests_bond_removal_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bond_removal.yml' import_playbook: playbooks/tests_bond_removal.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bond_removal_nm.yml b/tests/tests_bond_removal_nm.yml index 2d49280..a8b9782 100644 --- a/tests/tests_bond_removal_nm.yml +++ b/tests/tests_bond_removal_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bond_removal.yml' import_playbook: playbooks/tests_bond_removal.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bridge_cloned_mac_initscripts.yml b/tests/tests_bridge_cloned_mac_initscripts.yml index fa79a07..71586e9 100644 --- a/tests/tests_bridge_cloned_mac_initscripts.yml +++ b/tests/tests_bridge_cloned_mac_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bridge_cloned_mac.yml' import_playbook: playbooks/tests_bridge_cloned_mac.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bridge_cloned_mac_nm.yml b/tests/tests_bridge_cloned_mac_nm.yml index 86db05d..575e21e 100644 --- a/tests/tests_bridge_cloned_mac_nm.yml +++ b/tests/tests_bridge_cloned_mac_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bridge_cloned_mac.yml' import_playbook: playbooks/tests_bridge_cloned_mac.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_bridge_initscripts.yml b/tests/tests_bridge_initscripts.yml index e74ac6b..1c08483 100644 --- a/tests/tests_bridge_initscripts.yml +++ b/tests/tests_bridge_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_bridge.yml' import_playbook: playbooks/tests_bridge.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_bridge_nm.yml b/tests/tests_bridge_nm.yml index 53af046..c44b4a3 100644 --- a/tests/tests_bridge_nm.yml +++ b/tests/tests_bridge_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_bridge.yml' import_playbook: playbooks/tests_bridge.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_default_initscripts.yml b/tests/tests_default_initscripts.yml index 560bd2a..dd525f8 100644 --- a/tests/tests_default_initscripts.yml +++ b/tests/tests_default_initscripts.yml @@ -11,5 +11,5 @@ - name: Import the playbook 'tests_default.yml' import_playbook: tests_default.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_default_nm.yml b/tests/tests_default_nm.yml index 317f6e3..49933ab 100644 --- a/tests/tests_default_nm.yml +++ b/tests/tests_default_nm.yml @@ -14,4 +14,4 @@ - name: Import the playbook 'tests_default.yml' import_playbook: tests_default.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_dummy_nm.yml b/tests/tests_dummy_nm.yml index c671200..ff8c8ff 100644 --- a/tests/tests_dummy_nm.yml +++ b/tests/tests_dummy_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_dummy.yml' import_playbook: playbooks/tests_dummy.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_eth_dns_support_nm.yml b/tests/tests_eth_dns_support_nm.yml index 682a7db..39057c3 100644 --- a/tests/tests_eth_dns_support_nm.yml +++ b/tests/tests_eth_dns_support_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_eth_dns_support.yml' import_playbook: playbooks/tests_eth_dns_support.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_eth_pci_address_match_nm.yml b/tests/tests_eth_pci_address_match_nm.yml index 5277804..ca0737a 100644 --- a/tests/tests_eth_pci_address_match_nm.yml +++ b/tests/tests_eth_pci_address_match_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_eth_pci_address_match.yml' import_playbook: playbooks/tests_eth_pci_address_match.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.26.0', '>=') diff --git a/tests/tests_ethernet_initscripts.yml b/tests/tests_ethernet_initscripts.yml index 51de169..2ba274e 100644 --- a/tests/tests_ethernet_initscripts.yml +++ b/tests/tests_ethernet_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_ethernet.yml' import_playbook: playbooks/tests_ethernet.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_ethernet_nm.yml b/tests/tests_ethernet_nm.yml index 4d534a7..d2d2867 100644 --- a/tests/tests_ethernet_nm.yml +++ b/tests/tests_ethernet_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_ethernet.yml' import_playbook: playbooks/tests_ethernet.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_ethtool_coalesce_initscripts.yml b/tests/tests_ethtool_coalesce_initscripts.yml index 198f30b..a46d4cb 100644 --- a/tests/tests_ethtool_coalesce_initscripts.yml +++ b/tests/tests_ethtool_coalesce_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_ethtool_coalesce.yml' import_playbook: playbooks/tests_ethtool_coalesce.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_ethtool_coalesce_nm.yml b/tests/tests_ethtool_coalesce_nm.yml index 595e8f6..d720c4e 100644 --- a/tests/tests_ethtool_coalesce_nm.yml +++ b/tests/tests_ethtool_coalesce_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_ethtool_coalesce.yml' import_playbook: playbooks/tests_ethtool_coalesce.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.25.1', '>=') diff --git a/tests/tests_ethtool_features_initscripts.yml b/tests/tests_ethtool_features_initscripts.yml index fa3e714..d499e58 100644 --- a/tests/tests_ethtool_features_initscripts.yml +++ b/tests/tests_ethtool_features_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_ethtool_features.yml' import_playbook: playbooks/tests_ethtool_features.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_ethtool_features_nm.yml b/tests/tests_ethtool_features_nm.yml index 74c0fe1..8e65e8f 100644 --- a/tests/tests_ethtool_features_nm.yml +++ b/tests/tests_ethtool_features_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_ethtool_features.yml' import_playbook: playbooks/tests_ethtool_features.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.20.0', '>=') diff --git a/tests/tests_ethtool_ring_initscripts.yml b/tests/tests_ethtool_ring_initscripts.yml index f317817..e55dbc4 100644 --- a/tests/tests_ethtool_ring_initscripts.yml +++ b/tests/tests_ethtool_ring_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_ethtool_ring.yml' import_playbook: playbooks/tests_ethtool_ring.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_ethtool_ring_nm.yml b/tests/tests_ethtool_ring_nm.yml index e1b264c..12508ae 100644 --- a/tests/tests_ethtool_ring_nm.yml +++ b/tests/tests_ethtool_ring_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_ethtool_ring.yml' import_playbook: playbooks/tests_ethtool_ring.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.25.2', '>=') diff --git a/tests/tests_helpers_and_asserts.yml b/tests/tests_helpers_and_asserts.yml index adab888..9ba737a 100644 --- a/tests/tests_helpers_and_asserts.yml +++ b/tests/tests_helpers_and_asserts.yml @@ -25,7 +25,7 @@ # vars: # - type: tap # - interface: tap1298 -# when: ansible_distribution_major_version > 6 +# when: ansible_facts['distribution_major_version'] > 6 # # ip tuntap does not exist on RHEL6 # # FIXME: Maybe use some other tool to manage devices, openvpn can do # # this, but it is in EPEL diff --git a/tests/tests_ignore_auto_dns_nm.yml b/tests/tests_ignore_auto_dns_nm.yml index aa07f0c..dd633d3 100644 --- a/tests/tests_ignore_auto_dns_nm.yml +++ b/tests/tests_ignore_auto_dns_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_ignore_auto_dns.yml' import_playbook: playbooks/tests_ignore_auto_dns.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_infiniband_nm.yml b/tests/tests_infiniband_nm.yml index 619082a..8390eda 100644 --- a/tests/tests_infiniband_nm.yml +++ b/tests/tests_infiniband_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_infiniband.yml' import_playbook: playbooks/tests_infiniband.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_integration_pytest.yml b/tests/tests_integration_pytest.yml index b9db400..d78c920 100644 --- a/tests/tests_integration_pytest.yml +++ b/tests/tests_integration_pytest.yml @@ -8,7 +8,7 @@ - name: Import the playbook 'playbooks/integration_pytest_python3.yml' import_playbook: playbooks/integration_pytest_python3.yml - when: (ansible_distribution in ["CentOS", "RedHat"] and - ansible_distribution_major_version == "8") or - (ansible_distribution == "Fedora" and - ansible_distribution_major_version | int < 39) + when: (ansible_facts["distribution"] in ["CentOS", "RedHat"] and + ansible_facts["distribution_major_version"] == "8") or + (ansible_facts["distribution"] == "Fedora" and + ansible_facts["distribution_major_version"] | int < 39) diff --git a/tests/tests_ipv6_disabled_nm.yml b/tests/tests_ipv6_disabled_nm.yml index ced38f7..45e1a61 100644 --- a/tests/tests_ipv6_disabled_nm.yml +++ b/tests/tests_ipv6_disabled_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_ipv6_disabled.yml' import_playbook: playbooks/tests_ipv6_disabled.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_ipv6_dns_search_nm.yml b/tests/tests_ipv6_dns_search_nm.yml index f701da1..92eddeb 100644 --- a/tests/tests_ipv6_dns_search_nm.yml +++ b/tests/tests_ipv6_dns_search_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_ipv6_dns_search.yml' import_playbook: playbooks/tests_ipv6_dns_search.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_ipv6_initscripts.yml b/tests/tests_ipv6_initscripts.yml index 0e37cfe..1bcfe58 100644 --- a/tests/tests_ipv6_initscripts.yml +++ b/tests/tests_ipv6_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_ipv6.yml' import_playbook: playbooks/tests_ipv6.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_ipv6_nm.yml b/tests/tests_ipv6_nm.yml index bebd832..d07944c 100644 --- a/tests/tests_ipv6_nm.yml +++ b/tests/tests_ipv6_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_ipv6.yml' import_playbook: playbooks/tests_ipv6.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_mac_address_match_nm.yml b/tests/tests_mac_address_match_nm.yml index fed951a..670d9d8 100644 --- a/tests/tests_mac_address_match_nm.yml +++ b/tests/tests_mac_address_match_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_mac_address_match.yml' import_playbook: playbooks/tests_mac_address_match.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.18.0', '>=') diff --git a/tests/tests_network_state_nm.yml b/tests/tests_network_state_nm.yml index 0e88282..4c9241b 100644 --- a/tests/tests_network_state_nm.yml +++ b/tests/tests_network_state_nm.yml @@ -20,5 +20,5 @@ - name: Import the playbook 'playbooks/tests_network_state.yml' import_playbook: playbooks/tests_network_state.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution_major_version | int > 7 + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution_major_version'] | int > 7 diff --git a/tests/tests_provider_nm.yml b/tests/tests_provider_nm.yml index 04851ea..b67eb0a 100644 --- a/tests/tests_provider_nm.yml +++ b/tests/tests_provider_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,10 +40,10 @@ - name: Import the playbook 'playbooks/tests_provider.yml' import_playbook: playbooks/tests_provider.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.20.0', '>=') - - (ansible_distribution == 'Fedora' - and ansible_distribution_major_version | int < 41) - or ansible_distribution not in ['RedHat', 'CentOS', 'Fedora'] - or ansible_distribution_major_version | int < 9 + - (ansible_facts['distribution'] == 'Fedora' + and ansible_facts['distribution_major_version'] | int < 41) + or ansible_facts['distribution'] not in ['RedHat', 'CentOS', 'Fedora'] + or ansible_facts['distribution_major_version'] | int < 9 diff --git a/tests/tests_reapply_nm.yml b/tests/tests_reapply_nm.yml index 015c8f4..8c4205c 100644 --- a/tests/tests_reapply_nm.yml +++ b/tests/tests_reapply_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_reapply.yml' import_playbook: playbooks/tests_reapply.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_regression_nm.yml b/tests/tests_regression_nm.yml index 8ebab3a..6b9ddac 100644 --- a/tests/tests_regression_nm.yml +++ b/tests/tests_regression_nm.yml @@ -32,10 +32,10 @@ - name: Import the playbook 'playbooks/tests_checkpoint_cleanup.yml' import_playbook: playbooks/tests_checkpoint_cleanup.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' # The test depends on behavior that is only visible with newer NM - networkmanager_version is version('1.22.0', '>=') - - ansible_distribution not in ['RedHat', 'CentOS', 'Fedora'] or - (ansible_distribution == 'Fedora' and - ansible_distribution_major_version | int < 41) or - ansible_distribution_major_version | int < 9 + - ansible_facts['distribution'] not in ['RedHat', 'CentOS', 'Fedora'] or + (ansible_facts['distribution'] == 'Fedora' and + ansible_facts['distribution_major_version'] | int < 41) or + ansible_facts['distribution_major_version'] | int < 9 diff --git a/tests/tests_route_device_initscripts.yml b/tests/tests_route_device_initscripts.yml index 2bcc50c..4252f5f 100644 --- a/tests/tests_route_device_initscripts.yml +++ b/tests/tests_route_device_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_route_device.yml' import_playbook: playbooks/tests_route_device.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_route_device_nm.yml b/tests/tests_route_device_nm.yml index 46c3723..688a6ef 100644 --- a/tests/tests_route_device_nm.yml +++ b/tests/tests_route_device_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_route_device.yml' import_playbook: playbooks/tests_route_device.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_route_table_nm.yml b/tests/tests_route_table_nm.yml index 239b010..1249e9f 100644 --- a/tests/tests_route_table_nm.yml +++ b/tests/tests_route_table_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_route_table.yml' import_playbook: playbooks/tests_route_table.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_route_type_nm.yml b/tests/tests_route_type_nm.yml index 2977be7..519d377 100644 --- a/tests/tests_route_type_nm.yml +++ b/tests/tests_route_type_nm.yml @@ -16,7 +16,7 @@ - name: Install NetworkManager and get NetworkManager version when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' tags: - always block: @@ -40,6 +40,6 @@ - name: Import the playbook 'playbooks/tests_route_type.yml' import_playbook: playbooks/tests_route_type.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' - networkmanager_version is version('1.36.0', '>=') diff --git a/tests/tests_routing_rules_nm.yml b/tests/tests_routing_rules_nm.yml index b362207..a380abd 100644 --- a/tests/tests_routing_rules_nm.yml +++ b/tests/tests_routing_rules_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_routing_rules.yml' import_playbook: playbooks/tests_routing_rules.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_states_initscripts.yml b/tests/tests_states_initscripts.yml index fd9da21..e03d48d 100644 --- a/tests/tests_states_initscripts.yml +++ b/tests/tests_states_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_states.yml' import_playbook: playbooks/tests_states.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_states_nm.yml b/tests/tests_states_nm.yml index 53729d1..2762baf 100644 --- a/tests/tests_states_nm.yml +++ b/tests/tests_states_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_states.yml' import_playbook: playbooks/tests_states.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_switch_provider.yml b/tests/tests_switch_provider.yml index 5e90786..bcdffad 100644 --- a/tests/tests_switch_provider.yml +++ b/tests/tests_switch_provider.yml @@ -11,5 +11,5 @@ when: # The test requires NetworkManager and initscripts, therefore it can only # run on RHEL/CentOS 7, RHEL/CentOS 8, or Fedora - - ansible_distribution in ['CentOS', 'RedHat'] and - ansible_distribution_major_version in ['7', '8'] + - ansible_facts['distribution'] in ['CentOS', 'RedHat'] and + ansible_facts['distribution_major_version'] in ['7', '8'] diff --git a/tests/tests_team_nm.yml b/tests/tests_team_nm.yml index 9854133..7db9bd2 100644 --- a/tests/tests_team_nm.yml +++ b/tests/tests_team_nm.yml @@ -20,6 +20,6 @@ - name: Import the playbook 'playbooks/tests_team.yml' import_playbook: playbooks/tests_team.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution not in ['RedHat', 'CentOS'] or - ansible_distribution_major_version | int < 10 + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or + ansible_facts['distribution_major_version'] | int < 10 diff --git a/tests/tests_team_plugin_installation_nm.yml b/tests/tests_team_plugin_installation_nm.yml index cc97cbb..eab233e 100644 --- a/tests/tests_team_plugin_installation_nm.yml +++ b/tests/tests_team_plugin_installation_nm.yml @@ -20,6 +20,6 @@ - name: Import the playbook 'playbooks/tests_team_plugin_installation.yml' import_playbook: playbooks/tests_team_plugin_installation.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution not in ['RedHat', 'CentOS'] or - ansible_distribution_major_version | int < 10 + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or + ansible_facts['distribution_major_version'] | int < 10 diff --git a/tests/tests_unit.yml b/tests/tests_unit.yml index af3ccab..b62917b 100644 --- a/tests/tests_unit.yml +++ b/tests/tests_unit.yml @@ -134,7 +134,7 @@ environment: PYTHONPATH: "{{ _lsr_python_path }}" when: > - python2_available is succeeded and ansible_distribution != 'Fedora' + python2_available is succeeded and ansible_facts['distribution'] != 'Fedora' register: python2_result changed_when: false diff --git a/tests/tests_vlan_mtu_initscripts.yml b/tests/tests_vlan_mtu_initscripts.yml index 03f336e..bcd3c6d 100644 --- a/tests/tests_vlan_mtu_initscripts.yml +++ b/tests/tests_vlan_mtu_initscripts.yml @@ -15,5 +15,5 @@ - name: Import the playbook 'playbooks/tests_vlan_mtu.yml' import_playbook: playbooks/tests_vlan_mtu.yml - when: (ansible_distribution in ['CentOS','RedHat'] and - ansible_distribution_major_version | int < 9) + when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and + ansible_facts['distribution_major_version'] | int < 9) diff --git a/tests/tests_vlan_mtu_nm.yml b/tests/tests_vlan_mtu_nm.yml index bd648f0..313cd38 100644 --- a/tests/tests_vlan_mtu_nm.yml +++ b/tests/tests_vlan_mtu_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_vlan_mtu.yml' import_playbook: playbooks/tests_vlan_mtu.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_wireless_and_network_restart_nm.yml b/tests/tests_wireless_and_network_restart_nm.yml index 4a64e43..c933e39 100644 --- a/tests/tests_wireless_and_network_restart_nm.yml +++ b/tests/tests_wireless_and_network_restart_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_wireless_and_network_restart.yml' import_playbook: playbooks/tests_wireless_and_network_restart.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_wireless_nm.yml b/tests/tests_wireless_nm.yml index 495eee8..ae731e3 100644 --- a/tests/tests_wireless_nm.yml +++ b/tests/tests_wireless_nm.yml @@ -20,5 +20,5 @@ - name: Import the playbook 'playbooks/tests_wireless.yml' import_playbook: playbooks/tests_wireless.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution_major_version == '7' + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution_major_version'] == '7' diff --git a/tests/tests_wireless_plugin_installation_nm.yml b/tests/tests_wireless_plugin_installation_nm.yml index b24dbce..f036610 100644 --- a/tests/tests_wireless_plugin_installation_nm.yml +++ b/tests/tests_wireless_plugin_installation_nm.yml @@ -20,4 +20,4 @@ - name: Import the playbook 'playbooks/tests_wireless_plugin_installation.yml' import_playbook: playbooks/tests_wireless_plugin_installation.yml when: - - ansible_distribution_major_version != '6' + - ansible_facts['distribution_major_version'] != '6' diff --git a/tests/tests_wireless_wpa3_owe_nm.yml b/tests/tests_wireless_wpa3_owe_nm.yml index 148f092..8ad4e87 100644 --- a/tests/tests_wireless_wpa3_owe_nm.yml +++ b/tests/tests_wireless_wpa3_owe_nm.yml @@ -21,6 +21,6 @@ - name: Import the playbook 'playbooks/tests_wireless_wpa3_owe.yml' import_playbook: playbooks/tests_wireless_wpa3_owe.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution_major_version > '7' and ansible_distribution == 'CentOS' or - ansible_distribution_major_version > '32' and ansible_distribution == 'Fedora' + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution_major_version'] > '7' and ansible_facts['distribution'] == 'CentOS' or + ansible_facts['distribution_major_version'] > '32' and ansible_facts['distribution'] == 'Fedora' diff --git a/tests/tests_wireless_wpa3_sae_nm.yml b/tests/tests_wireless_wpa3_sae_nm.yml index 1fd9bdb..7981d97 100644 --- a/tests/tests_wireless_wpa3_sae_nm.yml +++ b/tests/tests_wireless_wpa3_sae_nm.yml @@ -21,5 +21,5 @@ - name: Import the playbook 'playbooks/tests_wireless_wpa3_sae.yml' import_playbook: playbooks/tests_wireless_wpa3_sae.yml when: - - ansible_distribution_major_version != '6' - - ansible_distribution_major_version != '7' and ansible_distribution != 'RedHat' + - ansible_facts['distribution_major_version'] != '6' + - ansible_facts['distribution_major_version'] != '7' and ansible_facts['distribution'] != 'RedHat' diff --git a/tests/vars/rh_distros_vars.yml b/tests/vars/rh_distros_vars.yml index d8f80ea..0e42264 100644 --- a/tests/vars/rh_distros_vars.yml +++ b/tests/vars/rh_distros_vars.yml @@ -15,7 +15,7 @@ __network_rh_distros: __network_rh_distros_fedora: "{{ __network_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__network_is_rh_distro: "{{ ansible_distribution in __network_rh_distros }}" +__network_is_rh_distro: "{{ ansible_facts['distribution'] in __network_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__network_is_rh_distro_fedora: "{{ ansible_distribution in __network_rh_distros_fedora }}" +__network_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __network_rh_distros_fedora }}"