-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: Add MD for role name rule (#2583)
* Docs: Add MD for role name rule * chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix spelling * chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * spell Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sorin Sbarnea <sorin.sbarnea@gmail.com>
- Loading branch information
1 parent
1887d39
commit bda8d99
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ mkdocs | |
mkdtemp | ||
mockings | ||
mypy | ||
myrole | ||
nestedincludes | ||
nocolor | ||
nodeps | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# role-name | ||
|
||
This rule checks role names to ensure they conform with requirements. | ||
|
||
Role names must contain only lowercase alphanumeric characters and the underscore `_` character. | ||
Role names must also start with an alphabetic character. | ||
|
||
For more information see the [roles directory](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_structure.html#roles-directory) topic in Ansible documentation. | ||
|
||
## Problematic Code | ||
|
||
```yaml | ||
--- | ||
- name: Example playbook | ||
hosts: localhost | ||
roles: | ||
- 1myrole # <- Does not start with an alphabetic character. | ||
- myrole2[*^ # <- Contains invalid special characters. | ||
- myRole_3 # <- Contains uppercase alphabetic characters. | ||
``` | ||
|
||
## Correct Code | ||
|
||
```yaml | ||
--- | ||
- name: Example playbook | ||
hosts: localhost | ||
roles: | ||
- myRole1 # <- Starts with an alphabetic character. | ||
- myrole2 # <- Contains only alphanumeric characters. | ||
- myrole_3 # <- Contains only lowercase alphabetic characters. | ||
``` |