Closed dzintars closed 1 year ago
Hi,
If I understand you correctly, you'd like to have all tasks have a prefix. Should that prefix be selected from:
Or is that prefix free-format?
I don't see why a prefix solves the observability issue, if unique name:
s are used, that should help the User right?
And another issue; ansible-lint would like all named tasks to start with a capital.
I'm curious to your way of thinking, please let me know.
First of all, this is only my opinionated suggestion. 😃
By the rules of ansible-lint, prefix should match the file name in which the task is defined.
Capitalized named tasks rule applies to - name: filename | This is the capitalized task name
part. Not to the prefix itself.
In your case prefixes would be:
enable_list: - name[prefix]
should be explicitly enabled in ansible-lint config.
There is some random documentation i just found about it Good Practices for Ansible - GPA
All of this does not matter much if you are working just with one or few roles. But when you have entire playbooks which consumes 20-50-100 roles, this becomes quite important. Because you have such generic role, i see it being used in larger playbooks and thus IMHO task naming becomes important.
I would suggest to try it locally and to play with --list-tasks
on entire playbook to see the effect.
This one if fixes, actually on all my roles.
And; indeed it's useful! Thanks for then hint. 👊🏻
Proposed feature
Use task name prefix like
- name: lsp | Install Cargo crates
andenable_list: - name[prefix]
in Ansible Lint.Rationale
Because this role is organized into multiple files and can be imported in larger playbook it is important to provide observability for the users. It is common to rely on
--list-tasks
to quickly identify executable tasks and their locations in the roles.As you can see, user is able easily identify the source of particular task.
Same goes to spot the source of failing tasks.