-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ansible-lint should allow role names beginning with a underscore #4370
Comments
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.
|
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 😃. I've opened up another issue over at ansible/ansible-documentation#2035 and a forum discussion as well. Hopefully someone can shed some light on this. |
We're currently following the Ansible documentation for this, but if the circumstances change and documentation is updated, we can reopen this and update the linter accordingly. For now, closing this as not planned. |
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 the
var-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
The text was updated successfully, but these errors were encountered: