Add your description here
Project description
ansible-lint-custom-strict-naming
Ansible is a powerful tool for configuration management. But it is difficult to maintain the YAML playbook quality. Variable maintenance is one of the difficult tasks because they can be overwritten unexpectedly, if you don't care about such like precedence and position where variables are defined.
This is a strict rule for variable naming, using ansible-lint. Strict naming rule is useful to avoid name collision and to search defined position.
Rules
var_name_prefix
<role_name>_role__ , <task_name>_tasks__
-
prefix Variables defined in <role_name>_role__roles/<role_name>/tasks/<role_name>_tasks__<not_roles>/**/tasks/ -
In ansible-lint,
var-naming[no-role-prefix]require to use<role_name>_as prefix. But it is not enough to avoid name collision or search defined position. So, I add_role__or_tasks__to the prefix.
var__, const__
var__prefix- Variables dynamically defined by
ansible.builtin.set_factorregister
- Variables dynamically defined by
const__prefix- Variables dynamically defined by
ansible.builtin.set_factorregister - Variables statically defined in such like inventory's vars, group_vars, host_vars and etc.
- Variables dynamically defined by
Vars in tasks/<name>.yml or roles/<name>/tasks/main.yml
-
<name>_role__var__prefix- These variables are dynamically defined in
roles/<name>/tasks/main.yml.
- These variables are dynamically defined in
-
<name>_role__const__prefix- These variables are defined in
roles/<name>/vars/main.ymland shouldn't be changed dynamically.
- These variables are defined in
-
some_role__arg__prefix- These variables are defined by
ansible.builtin.include_role'svarskey and shouldn't be changed dynamically.
- These variables are defined by
-
some_role__args-
These variables are defined by
ansible.builtin.include_role'svarskey and shouldn't be changed dynamically.- name: Sample ansible.builtin.include_role: name: some_role vars: some_role__arg__key1: value1 some_role__arg__key2: value2
-
This is useful when you want to send vars as dict.
- name: Sample ansible.builtin.include_role: name: some_role vars: some_role__args: key1: value1 key2: value2
-
Others
Double underscores?
- Single underscore (
_) is used to separate words. Double underscores (__) are used to separate chunks for readability. - examples
var__send_message__user_idvar__send_message__contentsome_role__const__app_config__namesome_role__const__app_config__tokensome_role__const__app_config__version
Docs
Articles
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansible_lint_custom_strict_naming-1.1.2.tar.gz.
File metadata
- Download URL: ansible_lint_custom_strict_naming-1.1.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b490e596ec09ffcddefb255f5dd055de1a281720873b1080e4332317e5d9267f
|
|
| MD5 |
4e7bec4aaa7648f48b002b561552289e
|
|
| BLAKE2b-256 |
511fd782f23d5742c682590a9c4d6e9fb0d7072e0fc81a94f2f52366c425fde0
|
File details
Details for the file ansible_lint_custom_strict_naming-1.1.2-py3-none-any.whl.
File metadata
- Download URL: ansible_lint_custom_strict_naming-1.1.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d1ab53de9646eff8d987d99cd5731a375c1330c5eb3f6085d6284e2be15df29
|
|
| MD5 |
d32db9b85d0cb51248b4a58dccf14732
|
|
| BLAKE2b-256 |
82a1e519b0253a252a2b4ab841f9c86d1c4bf2a178c2e1016f67949c414fdb29
|