ansible / ansible-lint

ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you
https://ansible.readthedocs.io/projects/lint/
GNU General Public License v3.0
3.49k stars 663 forks source link

Error finding collection roles from collection playbook with config specified #2333

Open greg-hellings opened 2 years ago

greg-hellings commented 2 years ago
Summary

In a collection, one role can import another role just fine. And a playbook inside that collection can also call that role without problem. However, if a custom configuration file path is specified AND there is a playbook importing that role, then the playbook fails lint because it cannot locate the included roles.

When the custom configuration path is passed to listing the roles, they succeed. And when the configuration path is omitted on the playbook, lint succeeds.

I have created a minimal reproducer here, including all four combinations of the arguments.

Issue Type
OS / ENVIRONMENT

All

STEPS TO REPRODUCE

See Github Actions job in my minimal reproducer repo

Desired Behavior

Specifying a custom configuration file should not break linting of collection based playbooks

Actual Behavior

Ansible lint errors with unknown role when a plsybook inside a collection calls a role from the same collection and a custom ansible-lint config file path is specified on the command line.

ssbarnea commented 2 years ago

@greg-hellings That repo si private

greg-hellings commented 2 years ago

@ssbarnea Oops, should be fixed now