-
Notifications
You must be signed in to change notification settings - Fork 519
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
Role names should be able to begin with a underscore. #2035
Comments
Files identified in the description: None If these files are incorrect, please update the |
Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the |
Thanks @gardar - you bring up interesting points. Can you open a forum topic on this so it gets wider community discussion, and then add the link to that topic here? |
Sure thing, opened a discussion here: https://forum.ansible.com/t/role-names-in-collections-should-be-able-to-begin-with-a-underscore/10454 |
Traced this down to the initial commit for the collection structure docs 49983fd, but I don't see any reasoning behind it. Perhaps this was an issue with the old galaxy and not valid anymore? |
@samccann If you need a decision by ansible-core, you could add it to our triage queue by adding the techreview label. |
Thanks @s-hertel ! added the label. |
As the original author of a lot of the collections guts in core, I'm not aware of any technical limitations to underscore-prefixing any component of an FQCN. IIRC the first implementation used the same validation rules for all components out of sheer laziness on my part, which may have contributed to the origin of the rule. I don't think we want to allow |
(and I realize I'm saying this not weeks after creating an internal core collection name starting with |
Summary
According to the
Collection structure
chapter of the docs:However, I've observed that role names can start with an underscore
_
character without causing any issues. I have tried this with Ansible versions 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2,15, 2.16 and 2.17, and none of them had problems consuming a role with such a name. Ansible Galaxy also imports the role without any issues.I understand that a role name like this might not be aesthetically pleasing, but there is a good reason for it. We recently added an Ansible role for common shared tasks to the [prometheus ansible collection](https://github.com/prometheus-community/ansible). The role is named
_common
(fqcnprometheus.prometheus._common
) to distinguish it from the other roles in the collection, as it is an internal role that's only supposed to be used by the other roles and not directly by a user.Related: ansible/ansible-lint#4370
Issue Type
Bug Report
Component Name
core
Ansible Version
N/A
Configuration
N/A
OS / Environment
N/A
Steps to Reproduce
N/A
Expected Results
N/A
Actual Results
N/A
Code of Conduct
The text was updated successfully, but these errors were encountered: