Skip to content

Role names should be able to begin with a underscore. #2035

Open
@gardar

Description

@gardar

Summary

According to the Collection structure chapter of the docs:

Role names are now limited to contain only lowercase alphanumeric characters, plus _ and start with an alpha character.

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 (fqcn prometheus.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

  • I agree to follow the Ansible Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew_contributorThis PR is the first contribution by a new community member.

    Type

    No type

    Projects

    • Status

      🆕 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions