name[template]: Jinja templates should only be at the end of 'name'
roles/role_name/tasks/main.yml:39 Task/Handler: Copy file in {{ role_name_conf.dest }} of {{ role_name_server.name }}
Does this rule implicitly says that only a single one var can be added in the task name?
Is there a way to add mutiple vars without trigger this violation?
Of course, I can add a lint skip, but I would like to write plays without skipping rules.
Thank you very much for every hints.
# ansible-lint --version
ansible-lint 24.7.0 using ansible-core:2.16.9 ansible-compat:24.7.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
You can work around this in a way that also results in the name being templated when it wouldn’t otherwise be (for example when a task is skipped?), for example:
The rationale behind that rule is to simplify finding the task in the playbook based on the task’s name. All workarounds make it harder to find the corresponding task, or make it harder to read the template code.
So either rewrite the task’s title (and not the way you template it) so you only need to template in one place (namely at the end), or use noqa / disable the rule. Every other solution makes the situation worse and goes against the spirit of the linting rule.