Open gardar opened 4 days ago
I wonder if this implies that there is a bug elsewhere (e.g. docs, Galaxy), as according to the documentation, the verbiage suggests roles within a collection starting with an underscore shouldn't be able to be imported via Galaxy.
The collection import into Galaxy will fail if a role name does not comply with these rules.
Definitely looks like incorrect information in the docs. Perhaps galaxy struggled with this in the past or maybe it's an issue with standalone roles. Or maybe someone just thought it would be ugly to name roles like that 😃. In any case, I haven't seen any scenario where that name causes the role to fail.
I've opened up another issue over at https://github.com/ansible/ansible-documentation/issues/2035 and a forum discussion as well. Hopefully someone can shed some light on this.
Summary
Recently we added a ansible role for common shared tasks to the prometheus ansible collection. The role is named
_common
(fqcnprometheus.prometheus._common
) to distinguish it from the other roles in the collection, as it is a internal role that's only supposed to be used by the other roles and not directly by a user.ansible-lint generates false positives for that particular role, the
role-name
rule and thevar-naming[no-role-prefix]
rule. The error message for thevar-naming[no-role-prefix]
rule suggests that the variable should be named exactly like it is already named, for example:I know the Ansible docs suggest that role names should not begin with a underscore, but Ansible does not seem to have any issues with consuming a role with a name like this, and neither does ansible galaxy have any issues with importing the role. I've tested with every ansible version between 2.9 - 2.17.
Issue Type
OS / ENVIRONMENT
Using ansible-lint github action.
STEPS TO REPRODUCE
Desired Behavior
ansible-lint should allow ansible role names beginning with
_
. At least when they are a part of a collection, continue to disallow a_
prefix in standalone roles is probably a good idea.Actual Behavior
Please give some details of what is happening. Include a [minimum complete verifiable example] with:
ansible-playbook --syntax-check playbook