network/tests/tests_switch_provider.yml
Wen Liang b02e58db76 Fix the failure of running ANSIBLE_GATHERING=explicit on tests_switch_provider.yml
The test `tests_switch_provider.yml` fails to run with
`ANSIBLE_GATHERING=explicit` with the error described below. Therefore,
include the task 'el_repo_setup.yml' before running the test which
supports gathering the minimum subset of facts required.

```
TASK [set fact to use initscripts network_provider]
task path: /tmp/tmp.Q6nP8W4iPS/rhel_system_roles/tests/network/playbooks/tests_switch_provider.yml:8
fatal: [/tmp/tmp.Q6nP8W4iPS/RHEL_8_8_TESTING.qcow2]: FAILED! => {}
MSG:
The conditional check 'ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_major_version in ['7', '8']' failed. The error
was: error while evaluating conditional (ansible_distribution in
['CentOS', 'RedHat'] and ansible_distribution_major_version in
['7', '8']): 'ansible_distribution' is undefined.
```

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-27 15:14:49 -06:00

15 lines
590 B
YAML

# SPDX-License-Identifier: BSD-3-Clause
---
- hosts: all
name: Run playbook 'playbooks/tests_switch_provider.yml'
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Import the playbook 'playbooks/tests_switch_provider.yml'
import_playbook: playbooks/tests_switch_provider.yml
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']