network/tests/tests_helpers_and_asserts.yml
Rich Megginson 65e74567d4 refactor: support Ansible 2.19
The big problem was trying to use `vars` with `import_playbook`.

We do not need to use `import_playbook` when `include_tasks` will
work.  Perhaps the original author of these tests thought that
the play `roles` keyword was the only way to invoke roles, so
that had to be "called" using an `import_playbook`?

Use `include_tasks` instead of `import_playbook`, and move some
of those "tasks" playbooks to be tasks files in tests/tasks.

Use `include_role` instead of `import_role`.

Do not set variables using `set_fact` if they have already been
set at the appropriate scope using `vars`.

"Modernize" the code somewhat.

Improve formatting.

Work around an Ansible bug https://github.com/ansible/ansible/issues/85394

Fix ansible-lint and ansible-test issues related newer versions of
those tools.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-07-02 14:42:43 -06:00

31 lines
1 KiB
YAML

# SPDX-License-Identifier: BSD-3-Clause
---
- name: Check that creating and removing test devices and assertions work
hosts: all
tasks:
- name: Include the task 'el_repo_setup.yml'
include_tasks: tasks/el_repo_setup.yml
- name: Test veth interface management
include_tasks: tasks/create_and_remove_interface.yml
vars:
type: veth
interface: veth1298
- name: Test veth interface management with dummy interface
include_tasks: tasks/create_and_remove_interface.yml
vars:
type: dummy
interface: dummy1298
# FIXME: when: does not seem to work with include_tasks, therefore this cannot
# be safely tested for now
# - name: test tap interfaces
# include_tasks: tasks/create_and_remove_interface.yml
# vars:
# - type: tap
# - interface: tap1298
# when: ansible_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