mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
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>
21 lines
788 B
YAML
21 lines
788 B
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
---
|
|
- 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
|
|
|
|
# module_warning - see https://github.com/ansible/ansible/issues/85394
|
|
- name: Test warning and info logs
|
|
assert:
|
|
that:
|
|
- "'warnings' not in __network_connections_result or
|
|
__network_connections_result.warnings | reject('match', module_warning ~ '$') | list | length == 0"
|
|
msg: "There are warnings"
|
|
vars:
|
|
module_warning: >-
|
|
Error loading plugin 'ansible.netcommon.network': No module named 'ansible_collections.ansible.netcommon'
|