network/tests/tests_switch_provider.yml
Rich Megginson 39ac91d9af 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 <rmeggins@redhat.com>
2026-01-07 18:43:15 -05:00

15 lines
608 B
YAML

# SPDX-License-Identifier: BSD-3-Clause
---
- name: Run playbook 'playbooks/tests_switch_provider.yml'
hosts: all
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_facts['distribution'] in ['CentOS', 'RedHat'] and
ansible_facts['distribution_major_version'] in ['7', '8']