Commit graph

8 commits

Author SHA1 Message Date
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
Wen Liang
5ff1189409 ansible-lint: Fix name[missing] and name[play] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
aa3b6bd8dc ansible-lint: Fix remaining name[casing] warnings
More name[casing] warnings are discovered by ansible-lint,
this may be due to the upgrade of ansible-lint.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-05 16:52:39 -06:00
Wen Liang
b1d2f305c2 ansible-lint: Fix remaining jinja[spacing] warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-05 16:44:41 -06:00
Wen Liang
8eed9ae4a9 ansible-lint: Fix ignore-errors failures
In some test playbooks, the `ignore_errors: true` can not be replaced
by `changed_when: false`, because `changed_when` is not a valid
attribute for a IncludeRole.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-28 18:41:23 +02:00
Wen Liang
101920be5c ansible-lint: Fix yaml[truthy] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-02-20 15:00:28 +01:00
Noriko Hosoi
34665b916d Cleaning up ansible-lint errors except '106', '303' and '403'
That is the following errors are fixed.
'206'  # Variables should have spaces before and after: {{ var_name }}
'208'  # File permissions unset or incorrect
'301'  # Commands should not change things if nothing needs doing
'305'  # Use shell only when shell functionality is required
'502'  # All tasks should be named
'601'  # Don't compare to literal True/False
'602'  # Don't compare to empty string

RHELPLAN-73471

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2021-04-15 20:53:53 +02:00
Jack Adolph
97129717a5 Rename files to be valid python identifiers 2020-04-22 17:40:03 +02:00
Renamed from tests/get-coverage.yml (Browse further)