test: ensure role gathers the facts it uses by having test clear_facts before include_role

The role gathers the facts it uses.  For example, if the user uses
`ANSIBLE_GATHERING=explicit`, the role uses the `setup` module with the
facts and subsets it requires.

This change allows us to test this.  Before every role invocation, the test
will use `meta: clear_facts` so that the role starts with no facts.

Create a task file tests/tasks/run_role_with_clear_facts.yml to do the tasks
to clear the facts and run the role.  Note that this means we don't need to
use `gather_facts` for the tests.

Some vars defined using `ansible_facts` have been changed to be defined with
`set_fact` instead.  This is because of the fact that `vars` are lazily
evaluated - the var might be referenced when the facts have been cleared, and
will issue an error like `ansible_facts["distribution"] is undefined`.  This is
typically done for blocks that have a `when` condition that uses `ansible_facts`
and the block has a role invocation using run_role_with_clear_facts.yml
These have been rewritten to define the `when` condition using `set_fact`.  This
is because the `when` condition is evaluated every time a task is invoked in the
block, and if the facts are cleared, this will raise an undefined variable error.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
Rich Megginson 2026-03-09 11:58:21 -06:00 committed by Richard Megginson
parent ded5545b0d
commit 88a2609327
120 changed files with 999 additions and 452 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
"""Check that there is a playbook to run all role tests with both providers"""
# vim: fileencoding=utf8
import difflib
@ -8,11 +9,10 @@ import glob
import os
import sys
GET_NM_VERSION = """
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -30,8 +30,7 @@ GET_NM_VERSION = """
ansible_facts.packages['NetworkManager'][0]['version'] }}"
"""
MINIMUM_NM_VERSION_CHECK = """
- networkmanager_version is version({minimum_nm_version}, '>=')
MINIMUM_NM_VERSION_CHECK = """ - networkmanager_version is version({minimum_nm_version}, '>=')
"""
EXTRA_RUN_CONDITION_PREFIX = " - "
@ -51,6 +50,16 @@ RUN_PLAYBOOK_WITH_NM = """# SPDX-License-Identifier: BSD-3-Clause
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{{{ ansible_facts['distribution_major_version'] }}}}"
__network_is_rhel: "{{{{ ansible_facts['distribution'] == 'RedHat' }}}}"
__network_is_fedora: "{{{{ ansible_facts['distribution'] == 'Fedora' }}}}"
__network_is_centos: "{{{{ ansible_facts['distribution'] == 'CentOS' }}}}"
__network_is_os_family_rhel: "{{{{ ansible_facts['os_family'] == 'RedHat' }}}}"
__is_rh_distro: "{{{{ __network_is_rh_distro }}}}"
{get_nm_version}
# The test requires or should run with NetworkManager, therefore it cannot run
@ -58,24 +67,57 @@ RUN_PLAYBOOK_WITH_NM = """# SPDX-License-Identifier: BSD-3-Clause
{comment}- name: Import the playbook '{test_playbook}'
import_playbook: {test_playbook}
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
{minimum_nm_version_check}{extra_run_condition}"""
RUN_PLAYBOOK_WITH_INITSCRIPTS = """# SPDX-License-Identifier: BSD-3-Clause
# This file was generated by ensure_provider_tests.py
---
# yamllint disable rule:line-length
- name: Run playbook '{test_playbook}' with initscripts as provider
hosts: all
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Set network provider to 'initscripts'
set_fact:
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{{{ ansible_facts['distribution_major_version'] }}}}"
__network_is_rhel: "{{{{ ansible_facts['distribution'] == 'RedHat' }}}}"
__network_is_fedora: "{{{{ ansible_facts['distribution'] == 'Fedora' }}}}"
__network_is_centos: "{{{{ ansible_facts['distribution'] == 'CentOS' }}}}"
__network_is_os_family_rhel: "{{{{ ansible_facts['os_family'] == 'RedHat' }}}}"
__is_rh_distro: "{{{{ __network_is_rh_distro }}}}"
- name: Import the playbook '{test_playbook}'
import_playbook: {test_playbook}
when:
- __is_rh_distro
- __network_distro_major_version | int < 9
"""
MINIMUM_VERSION = "minimum_version"
EXTRA_RUN_CONDITION = "extra_run_condition"
NM_ONLY_TESTS = {
"playbooks/tests_802_1x_updated.yml": {
EXTRA_RUN_CONDITION: (
"(ansible_facts['distribution'] != 'RedHat' and\n"
" ansible_facts['distribution_major_version'] | int > 7) or\n"
" ansible_facts['distribution_major_version'] | int == 8"
"(not __network_is_rhel and\n"
" __network_distro_major_version | int > 7) or\n"
" __network_distro_major_version | int == 8"
),
},
"playbooks/tests_802_1x.yml": {
EXTRA_RUN_CONDITION: (
"(ansible_facts['distribution'] != 'RedHat' and\n"
" ansible_facts['distribution_major_version'] | int > 7) or\n"
" ansible_facts['distribution_major_version'] | int == 8"
"(not __network_is_rhel and\n"
" __network_distro_major_version | int > 7) or\n"
" __network_distro_major_version | int == 8"
),
},
"playbooks/tests_ignore_auto_dns.yml": {},
@ -92,12 +134,12 @@ NM_ONLY_TESTS = {
},
"playbooks/tests_provider.yml": {
MINIMUM_VERSION: "'1.20.0'",
"comment": "# NetworKmanager 1.20.0 added support for forgetting profiles",
"comment": "# NetworkManager 1.20.0 added support for forgetting profiles",
EXTRA_RUN_CONDITION: (
"(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"
"(__network_is_fedora and\n"
" __network_distro_major_version | int < 41)\n"
" or not __network_is_os_family_rhel\n"
" or __network_distro_major_version | int < 9"
),
},
"playbooks/tests_eth_pci_address_match.yml": {
@ -105,7 +147,7 @@ NM_ONLY_TESTS = {
"comment": "# NetworkManager 1.26.0 added support for match.path setting",
},
"playbooks/tests_network_state.yml": {
EXTRA_RUN_CONDITION: "ansible_facts['distribution_major_version'] | int > 7",
EXTRA_RUN_CONDITION: "__network_distro_major_version | int > 7",
},
"playbooks/tests_reapply.yml": {},
"playbooks/tests_route_table.yml": {},
@ -117,30 +159,30 @@ blackhole, prohibit and unreachable",
"playbooks/tests_routing_rules.yml": {},
# teaming support dropped in EL10
"playbooks/tests_team.yml": {
EXTRA_RUN_CONDITION: "ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or\n ansible_facts['distribution_major_version'] | int < 10",
EXTRA_RUN_CONDITION: "not __is_rh_distro or\n __network_distro_major_version | int < 10",
},
"playbooks/tests_team_plugin_installation.yml": {
EXTRA_RUN_CONDITION: "ansible_facts['distribution'] not in ['RedHat', 'CentOS'] or\n ansible_facts['distribution_major_version'] | int < 10",
EXTRA_RUN_CONDITION: "not __is_rh_distro or\n __network_distro_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_facts['distribution_major_version'] == '7'",
EXTRA_RUN_CONDITION: "__network_distro_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_facts['distribution_major_version'] > '7' and \
ansible_facts['distribution'] == 'CentOS' or\n ansible_facts['distribution_major_version'] > '32' \
and ansible_facts['distribution'] == 'Fedora'",
EXTRA_RUN_CONDITION: "__network_distro_major_version | int > 7 and \
__network_is_centos or\n __network_distro_major_version | int > 32 \
and __network_is_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_facts['distribution_major_version'] != '7' and \
ansible_facts['distribution'] != 'RedHat'",
EXTRA_RUN_CONDITION: "__network_distro_major_version != '7' and \
not __network_is_rhel",
},
}
# NM_CONDITIONAL_TESTS is used to store the test playbooks which are demanding for NM
@ -168,27 +210,6 @@ IGNORE = [
"playbooks/tests_switch_provider.yml",
]
RUN_PLAYBOOK_WITH_INITSCRIPTS = """# SPDX-License-Identifier: BSD-3-Clause
# This file was generated by ensure_provider_tests.py
---
# yamllint disable rule:line-length
- name: Run playbook '{test_playbook}' with initscripts as provider
hosts: all
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Set network provider to 'initscripts'
set_fact:
network_provider: initscripts
tags:
- always
- name: Import the playbook '{test_playbook}'
import_playbook: {test_playbook}
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and\n \
ansible_facts['distribution_major_version'] | int < 9)
"""
def create_nm_playbook(test_playbook):
fileroot = os.path.splitext(os.path.basename(test_playbook))[0]

View file

@ -0,0 +1 @@
../../library/network_connections.py

View file

@ -34,8 +34,7 @@
register: original_ethtool_coalesce
changed_when: false
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -57,8 +56,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -91,8 +89,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -118,14 +115,13 @@
- "tests::cleanup"
block:
- name: Deactivate the connection and remove the connection profile
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'manage_test_interface.yml'
include_tasks: tasks/manage_test_interface.yml
vars:

View file

@ -16,8 +16,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -48,8 +47,7 @@
command: ping -c1 203.0.113.1
changed_when: false
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -79,8 +77,7 @@
executable: /bin/bash
changed_when: false
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -105,8 +102,7 @@
command: ping -c1 203.0.113.1
changed_when: false
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -121,8 +117,7 @@
- "tests::cleanup"
block:
- name: Deactivate the connection and remove the connection profile
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -131,7 +126,7 @@
- name: br1
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'cleanup_802_1x_server.yml'
include_tasks: tasks/cleanup_802_1x_server.yml
- name: Remove test certificates

View file

@ -19,8 +19,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -68,8 +67,7 @@
debug:
msg: "##################################################"
- name: Import network role to remove interface
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -89,8 +87,7 @@
vars:
state: present
- name: Import network role to disable auto_gateway
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -134,8 +131,7 @@
debug:
msg: "##################################################"
- name: Import network role to remove interface again
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -34,8 +34,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller
@ -98,8 +97,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ port2_profile }}"
@ -111,7 +109,7 @@
- name: "{{ controller_profile }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ controller_device }}'
command: ip link del {{ controller_device }}
failed_when: false

View file

@ -25,8 +25,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller
@ -109,8 +108,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ port2_profile }}"
@ -122,7 +120,7 @@
- name: "{{ controller_profile }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ controller_device }}'
command: ip link del {{ controller_device }}
failed_when: false

View file

@ -34,8 +34,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller
@ -109,8 +108,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ port2_profile }}"
@ -122,7 +120,7 @@
- name: "{{ controller_profile }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ controller_device }}'
command: ip link del {{ controller_device }}
failed_when: false

View file

@ -34,8 +34,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller
@ -95,8 +94,7 @@
- name: Deactivate and remove the bond controller profile
"{{ controller_profile }}"
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ controller_profile }}"
@ -162,8 +160,7 @@
when: network_provider == "initscripts"
- name: Activate the bonding connection again
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller
@ -190,8 +187,7 @@
controller: "{{ controller_profile }}"
- name: Deactivate and remove all the port profiles
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ port1_profile }}"
@ -238,14 +234,13 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ controller_profile }}"
state: down
persistent_state: absent
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ controller_device }}'
command: ip link del {{ controller_device }}
failed_when: false

View file

@ -12,8 +12,7 @@
include_tasks: tasks/assert_device_absent.yml
- name: Add test bridge
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -7,8 +7,7 @@
cloned_mac: "12:23:34:45:56:70"
tasks:
- name: Add test bridge
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -18,9 +18,9 @@
include_tasks: tasks/show_interfaces.yml
- name: Include the task 'assert_device_absent.yml'
include_tasks: tasks/assert_device_absent.yml
roles:
- linux-system-roles.network
tasks:
- name: Run role with clear facts
include_tasks: tasks/run_role_with_clear_facts.yml
- name: Test checkpoint cleanup
block:
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1832897
@ -32,8 +32,7 @@
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
# create test profile
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_provider: initscripts
network_connections:

View file

@ -18,8 +18,7 @@
include_tasks: tasks/assert_device_present.yml
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -4,8 +4,7 @@
hosts: all
tasks:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: pseudo-pci-test-only
@ -37,8 +36,7 @@
address
- name: "Remove the PCI address from match path"
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: pseudo-pci-test-only
@ -71,13 +69,12 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: pseudo-pci-test-only
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Verify network state restored to default
include_tasks: tasks/check_network_dns.yml

View file

@ -26,8 +26,7 @@
include_tasks: tasks/assert_device_present.yml
- name: Test static interface up
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -37,8 +37,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -78,8 +77,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -121,8 +119,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -163,13 +160,12 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
failed_when: false
__sr_failed_when: false
- name: Include the task 'manage_test_interface.yml'
include_tasks: tasks/manage_test_interface.yml
vars:

View file

@ -41,8 +41,7 @@
register: original_ethtool_features
changed_when: false
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -65,8 +64,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -105,8 +103,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -181,8 +178,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -208,14 +204,13 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'manage_test_interface.yml'
include_tasks: tasks/manage_test_interface.yml
vars:

View file

@ -37,8 +37,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -78,8 +77,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -162,8 +160,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -204,13 +201,12 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
failed_when: false
__sr_failed_when: false
- name: Include the task 'manage_test_interface.yml'
include_tasks: tasks/manage_test_interface.yml
vars:

View file

@ -21,8 +21,7 @@
block:
- name: Configure an interface with ipv4_ignore_auto_dns disabled and
ipv6_ignore_auto_dns enabled
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -64,8 +63,7 @@
- "tests::cleanup"
block:
- name: Bring down test devices and profiles
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -14,8 +14,7 @@
debug:
msg: "##################################################"
- name: Setup the IP over the infiniband device
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -74,8 +73,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -84,7 +82,7 @@
- name: "{{ interface }}-10"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the virtual device
command: ip link del {{ interface }}.000a
failed_when: false

View file

@ -29,8 +29,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -94,8 +93,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -24,8 +24,7 @@
- name: Try configuration
block:
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -6,8 +6,7 @@
block:
- name: Configure the static IPv4 address and not configure the IPv6
address
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: br-example
@ -48,8 +47,7 @@
- name: Reconfigure the static IPv4 and IPv6 address, reconfigure DNS
and DNS search setting for IPv4 and IPv6
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: br-example
@ -82,8 +80,7 @@
- name: Reconfigure connection profile and only configure the static
IPv6 address
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: br-example
@ -112,40 +109,37 @@
msg: DNS search setting for IPv6 is not configured when only the
static IPv6 address is configured
- name: Reconfigure connection profile, disable both IPv4 and IPv6
import_role:
name: linux-system-roles.network
vars:
network_connections:
- name: br-example
type: bridge
ip:
dhcp4: false
ipv6_disabled: true
dns_search: example.com
state: up
ignore_errors: true # noqa ignore-errors
changed_when: false
when: ansible_facts["distribution_major_version"] | int > 7
- name: Check for errors when both IPv4 and IPv6 are disabled
when: __network_distro_major_version | int > 7
block:
- name: Reconfigure connection profile, disable both IPv4 and IPv6
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: br-example
type: bridge
ip:
dhcp4: false
ipv6_disabled: true
dns_search: example.com
state: up
rescue:
- name: Assert that reconfiguring network connection is failed
assert:
that:
- __network_connections_result.failed
msg: reconfiguring network connection is not failed
- name: Assert that reconfiguring network connection is failed
assert:
that:
- __network_connections_result.failed
msg: reconfiguring network connection is not failed
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
assert:
that:
- __network_connections_result.stderr is search("Setting
'dns_search', 'dns_options' and 'dns_priority' are not allowed
when both IPv4 and IPv6 are disabled.")
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_facts["distribution_major_version"] | int > 7
- name: Assert that configuring DNS search setting is not allowed when
both IPv4 and IPv6 are disabled
assert:
that:
- __network_connections_result.stderr is search("Setting
'dns_search', 'dns_options' and 'dns_priority' are not allowed
when both IPv4 and IPv6 are disabled.")
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."
always:
- name: Clean up the test device and the connection profile
@ -153,13 +147,12 @@
- "tests::cleanup"
block:
- name: Deactivate the connection and remove the connection profile
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: br-example
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Verify network state restored to default
include_tasks: tasks/check_network_dns.yml

View file

@ -36,8 +36,7 @@
- name: Configure the IP addresses
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_state:
interfaces:
@ -102,8 +101,7 @@
settings
- name: Configure the route
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_state:
routes:
@ -131,8 +129,7 @@
msg: the route configuration does not contain the specified route
- name: Configure the DNS
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_state:
dns-resolver:
@ -174,8 +171,7 @@
contain the specified DNS configuration
- name: Purge the DNS
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_state:
dns-resolver:

View file

@ -18,15 +18,14 @@
include_tasks: tasks/show_interfaces.yml
- name: Include the task 'assert_device_absent.yml'
include_tasks: tasks/assert_device_absent.yml
roles:
- linux-system-roles.network
tasks:
- name: Run role with clear facts
include_tasks: tasks/run_role_with_clear_facts.yml
- name: Test reapply the connection
block:
# create test profile
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -36,8 +36,7 @@
block:
- name: Configure the IP addresses and the route with interface name
specified
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface0 }}"
@ -111,8 +110,7 @@
changed_when: false
- name: Configure the IP addresses and the route with only the MAC
address specified
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface1 }}"
@ -157,8 +155,7 @@
- "tests::cleanup"
block:
- name: Bring down test devices and profiles
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface0 }}"

View file

@ -19,8 +19,7 @@
- name: Configure connection profile and specify the numeric table in
static routes
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -110,8 +109,7 @@
- name: Reconfigure connection profile and specify the named table in
static routes
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -19,8 +19,7 @@
- name: Configure connection profile and specify the route types in
static routes
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -100,8 +99,7 @@
specified route"
- name: Removing some routes
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -33,8 +33,7 @@
block:
- name: Configure connection profile and specify the numeric table in
static routes
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -10,8 +10,7 @@
tasks:
- name: "Through the initscripts provider, create test bridge
{{ interface }}"
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -40,8 +39,7 @@
- always
- name: "Through the nm provider, create test bridge {{ interface }}"
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -20,8 +20,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -59,8 +58,7 @@
debug:
msg: "##################################################"
- name: Import network role to remove interfaces
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -25,8 +25,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:
@ -43,8 +42,7 @@
key_mgmt: "wpa-psk"
password: "p@55w0rD"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -54,8 +52,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:
@ -85,14 +82,13 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'cleanup_mock_wifi.yml'
include_tasks: tasks/cleanup_mock_wifi.yml
- name: Verify network state restored to default

View file

@ -24,8 +24,7 @@
msg: "NetworkManager-wifi is not removed before wirelss configuration"
- name: "Wireless configuration"
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:

View file

@ -16,8 +16,7 @@
debug:
msg: "##################################################"
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:
@ -50,14 +49,13 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'cleanup_mock_wifi.yml'
include_tasks: tasks/cleanup_mock_wifi.yml
- name: Verify network state restored to default

View file

@ -12,8 +12,7 @@
- name: Test wireless connection with WPA3 Personal
block:
- name: "TEST: wireless connection with WPA3 Personal"
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:
@ -51,14 +50,13 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Include the task 'cleanup_mock_wifi.yml'
include_tasks: tasks/cleanup_mock_wifi.yml
- name: Verify network state restored to default

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -5,8 +5,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ port2_profile }}"
@ -18,7 +17,7 @@
- name: "{{ controller_profile }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ controller_device }}'
command: ip link del {{ controller_device }}
failed_when: false

View file

@ -5,8 +5,7 @@
- "tests::cleanup"
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ profile }}"
@ -18,7 +17,7 @@
- name: "{{ vlan_profile2 }}"
persistent_state: absent
state: down
failed_when: false
__sr_failed_when: false
- name: Delete the device '{{ interface }}'
command: ip link del {{ interface }}
failed_when: false

View file

@ -13,8 +13,7 @@
debug:
msg: "Retrieved MAC address for {{ interface }}: {{ mac }}"
- name: Test matching the port device based on the perm_hwaddr
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ profile }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Reconfigure the bond options
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
# Create a bond controller

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_allow_restart: true
network_connections:

View file

@ -3,8 +3,7 @@
- name: Create wireless connection with rescue
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_allow_restart: '{{ wifi_restart_network }}'
network_connections:

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Set down {{ profile }}
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ profile }}"

View file

@ -60,8 +60,7 @@
failed_when: connection_name is failed or connection_name.stdout | length == 0
- name: Bring down and delete the connection profile for '{{ interface }}'
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ connection_name.stdout }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: ../run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"
@ -14,8 +13,7 @@
address: 192.0.2.1/24
network_provider: initscripts
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: ../run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: ../run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: ../run_role_with_clear_facts.yml
vars:
network_connections: []
network_provider: nm

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Include network role
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Remove {{ profile }}
include_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ profile }}"

View file

@ -0,0 +1,39 @@
---
# Task file: save facts, clear_facts, run linux-system-roles.network, then restore facts.
# Include this with include_tasks or import_tasks; ensure tests/library is in module search path.
# Input:
# - __sr_tasks_from: tasks_from to run - same as tasks_from in include_role
# - __sr_public: export private vars from role - same as public in include_role
# - __sr_failed_when: set to false to ignore role errors - same as failed_when in include_role
# Output:
# - ansible_facts: merged saved ansible_facts with ansible_facts modified by the role, if any
- name: Clear facts
meta: clear_facts
# note that you can use failed_when with import_role but not with include_role
# so this simulates the __sr_failed_when false case
# Q: Why do we need a separate task to run the role normally? Why not just
# run the role in the block and rethrow the error in the rescue block?
# A: Because you cannot rethrow the error in exactly the same way as the role does.
# It might be possible to exactly reconstruct ansible_failed_result but it's not worth the effort.
- name: Run the role with __sr_failed_when false
when:
- __sr_failed_when is defined
- not __sr_failed_when
block:
- name: Run the role
include_role:
name: linux-system-roles.network
tasks_from: "{{ __sr_tasks_from | default('main') }}"
public: "{{ __sr_public | default(false) }}"
rescue:
- name: Ignore the failure when __sr_failed_when is false
debug:
msg: Ignoring failure when __sr_failed_when is false
- name: Run the role normally
include_role:
name: linux-system-roles.network
tasks_from: "{{ __sr_tasks_from | default('main') }}"
public: "{{ __sr_public | default(false) }}"
when: __sr_failed_when | d(true)

View file

@ -51,8 +51,7 @@
- name: Test configuring 802.1x authentication
block:
- name: Import network role
import_role:
name: linux-system-roles.network
include_tasks: run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface | default('802-1x-test') }}"

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,7 +30,7 @@
- name: Import the playbook 'playbooks/tests_802_1x.yml'
import_playbook: playbooks/tests_802_1x.yml
when:
- 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
- __network_distro_major_version != '6'
- (not __network_is_rhel and
__network_distro_major_version | int > 7) or
__network_distro_major_version | int == 8

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,7 +30,7 @@
- name: Import the playbook 'playbooks/tests_802_1x_updated.yml'
import_playbook: playbooks/tests_802_1x_updated.yml
when:
- 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
- __network_distro_major_version != '6'
- (not __network_is_rhel and
__network_distro_major_version | int > 7) or
__network_distro_major_version | int == 8

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_auto_gateway.yml'
import_playbook: playbooks/tests_auto_gateway.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_auto_gateway.yml'
import_playbook: playbooks/tests_auto_gateway.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bond_cloned_mac.yml'
import_playbook: playbooks/tests_bond_cloned_mac.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bond_cloned_mac.yml'
import_playbook: playbooks/tests_bond_cloned_mac.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bond_deprecated.yml'
import_playbook: playbooks/tests_bond_deprecated.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bond_deprecated.yml'
import_playbook: playbooks/tests_bond_deprecated.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bond.yml'
import_playbook: playbooks/tests_bond.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bond.yml'
import_playbook: playbooks/tests_bond.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bond_options.yml'
import_playbook: playbooks/tests_bond_options.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,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_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bond_removal.yml'
import_playbook: playbooks/tests_bond_removal.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bond_removal.yml'
import_playbook: playbooks/tests_bond_removal.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bridge_cloned_mac.yml'
import_playbook: playbooks/tests_bridge_cloned_mac.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bridge_cloned_mac.yml'
import_playbook: playbooks/tests_bridge_cloned_mac.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_bridge.yml'
import_playbook: playbooks/tests_bridge.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_bridge.yml'
import_playbook: playbooks/tests_bridge.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -37,15 +37,13 @@
- 192.0.2.2/24
block:
- name: Include the network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
register: __network_connections_result
- name: Assert change:true
assert:
that: __network_connections_result is changed
- name: Include the network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
register: __network_connections_result
- name: Assert change:false
assert:
@ -61,15 +59,13 @@
auto6: "no"
block:
- name: Include the network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
register: __network_connections_result
- name: Assert change:true
assert:
that: __network_connections_result is changed
- name: Include the network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
register: __network_connections_result
- name: Assert change:false
assert:
@ -80,8 +76,7 @@
- "tests::cleanup"
block:
- name: Include the network role
include_role:
name: linux-system-roles.network
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
network_connections:
- name: "{{ interface }}"

View file

@ -2,13 +2,13 @@
---
- name: Test executing the role with default parameters
hosts: all
gather_facts: false
roles:
- linux-system-roles.network
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Run role with clear facts
include_tasks: tasks/run_role_with_clear_facts.yml
# module_warning - see https://github.com/ansible/ansible/issues/85394
- name: Test warning and info logs
assert:

View file

@ -8,8 +8,19 @@
- name: Set network provider to 'initscripts'
set_fact:
network_provider: initscripts
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
- name: Import the playbook 'tests_default.yml'
import_playbook: tests_default.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __network_is_os_family_rhel
- __network_distro_major_version | int < 9

View file

@ -8,10 +8,22 @@
- name: Set network provider to 'nm'
set_fact:
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
# The test should run with NetworkManager, therefore it cannot run on
# RHEL/CentOS 6
- name: Import the playbook 'tests_default.yml'
import_playbook: tests_default.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_dummy.yml'
import_playbook: playbooks/tests_dummy.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_eth_dns_support.yml'
import_playbook: playbooks/tests_eth_dns_support.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -40,6 +50,5 @@
- name: Import the playbook 'playbooks/tests_eth_pci_address_match.yml'
import_playbook: playbooks/tests_eth_pci_address_match.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.26.0', '>=')

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_ethernet.yml'
import_playbook: playbooks/tests_ethernet.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_ethernet.yml'
import_playbook: playbooks/tests_ethernet.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_ethtool_coalesce.yml'
import_playbook: playbooks/tests_ethtool_coalesce.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -40,6 +50,5 @@
- name: Import the playbook 'playbooks/tests_ethtool_coalesce.yml'
import_playbook: playbooks/tests_ethtool_coalesce.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.25.1', '>=')

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_ethtool_features.yml'
import_playbook: playbooks/tests_ethtool_features.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -40,6 +50,5 @@
- name: Import the playbook 'playbooks/tests_ethtool_features.yml'
import_playbook: playbooks/tests_ethtool_features.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.20.0', '>=')

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_ethtool_ring.yml'
import_playbook: playbooks/tests_ethtool_ring.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -40,6 +50,5 @@
- name: Import the playbook 'playbooks/tests_ethtool_ring.yml'
import_playbook: playbooks/tests_ethtool_ring.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.25.2', '>=')

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_ignore_auto_dns.yml'
import_playbook: playbooks/tests_ignore_auto_dns.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_infiniband.yml'
import_playbook: playbooks/tests_infiniband.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -5,10 +5,20 @@
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
- name: Import the playbook 'playbooks/integration_pytest_python3.yml'
import_playbook: playbooks/integration_pytest_python3.yml
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)
when: (__network_is_fedora and
__network_distro_major_version | int < 39) or
(__network_is_os_family_rhel and
__network_distro_major_version == "8")

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_ipv6_disabled.yml'
import_playbook: playbooks/tests_ipv6_disabled.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_ipv6_dns_search.yml'
import_playbook: playbooks/tests_ipv6_dns_search.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -12,8 +12,18 @@
network_provider: initscripts
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Import the playbook 'playbooks/tests_ipv6.yml'
import_playbook: playbooks/tests_ipv6.yml
when: (ansible_facts['distribution'] in ['CentOS','RedHat'] and
ansible_facts['distribution_major_version'] | int < 9)
when:
- __is_rh_distro
- __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_ipv6.yml'
import_playbook: playbooks/tests_ipv6.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -40,6 +50,5 @@
- name: Import the playbook 'playbooks/tests_mac_address_match.yml'
import_playbook: playbooks/tests_mac_address_match.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.18.0', '>=')

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,5 +30,5 @@
- name: Import the playbook 'playbooks/tests_network_state.yml'
import_playbook: playbooks/tests_network_state.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- ansible_facts['distribution_major_version'] | int > 7
- __network_distro_major_version != '6'
- __network_distro_major_version | int > 7

View file

@ -13,10 +13,20 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
- name: Install NetworkManager and get NetworkManager version
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
tags:
- always
block:
@ -36,14 +46,13 @@
# The test requires or should run with NetworkManager, therefore it cannot run
# on RHEL/CentOS 6
# NetworKmanager 1.20.0 added support for forgetting profiles
# NetworkManager 1.20.0 added support for forgetting profiles
- name: Import the playbook 'playbooks/tests_provider.yml'
import_playbook: playbooks/tests_provider.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'
- networkmanager_version is version('1.20.0', '>=')
- (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
- (__network_is_fedora and
__network_distro_major_version | int < 41)
or not __network_is_os_family_rhel
or __network_distro_major_version | int < 9

View file

@ -13,6 +13,16 @@
network_provider: nm
tags:
- always
- name: Include distro variables
include_vars: vars/rh_distros_vars.yml
- name: Set platform facts
set_fact:
__network_distro_major_version: "{{ ansible_facts['distribution_major_version'] }}"
__network_is_rhel: "{{ ansible_facts['distribution'] == 'RedHat' }}"
__network_is_fedora: "{{ ansible_facts['distribution'] == 'Fedora' }}"
__network_is_centos: "{{ ansible_facts['distribution'] == 'CentOS' }}"
__network_is_os_family_rhel: "{{ ansible_facts['os_family'] == 'RedHat' }}"
__is_rh_distro: "{{ __network_is_rh_distro }}"
# The test requires or should run with NetworkManager, therefore it cannot run
@ -20,4 +30,4 @@
- name: Import the playbook 'playbooks/tests_reapply.yml'
import_playbook: playbooks/tests_reapply.yml
when:
- ansible_facts['distribution_major_version'] != '6'
- __network_distro_major_version != '6'

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