Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reports "All tasks should be named" when the task is named with no capital letter #4351

Open
bolinocroustibat opened this issue Sep 30, 2024 · 1 comment
Labels

Comments

@bolinocroustibat
Copy link

bolinocroustibat commented Sep 30, 2024

Environment: MacOS 15.0
Ansible version: 10.4.0

Given the following task in a playbook, calling tasks from a role named homebrew:

- name: Install and update Homebrew
  hosts: local
  tasks:
    - include_role:
        name: homebrew
        tasks_from: install
    - include_role:
        name: homebrew
        tasks_from: update

Ansible-lint raises the following warnings:

WARNING  Listing 2 violation(s) that are fatal
name[missing]: All tasks should be named.
playbooks/myplaybook.yaml:6 Task/Handler: include_role name=homebrew tasks_from=install

name[missing]: All tasks should be named.
playbooks/myplaybook.yaml:9 Task/Handler: include_role name=homebrew tasks_from=update 

...even though, obviously, the tasks are named.

When putting a capital letter to the roles names, the fatal warning disappear.
If I understand correctly what's happening, the warning doesn't raise the right issue (capital letter), but instead says the name is missing. If I don't, this is quite confusing and should be better explained.

@bolinocroustibat bolinocroustibat added bug new Triage required labels Sep 30, 2024
@bolinocroustibat bolinocroustibat changed the title Reports "All tasks should be named." whhen the task is named with no capital letter Reports "All tasks should be named" when the task is named with no capital letter Sep 30, 2024
@Qalthos
Copy link
Contributor

Qalthos commented Oct 16, 2024

Huh. This is actually kind of weird.

What it's actually looking for is the name attribute of the task itself to be present, not of the include_role module. So what the rule is expecting is something like

- name: Do the thing that the role specifies
  include_role:
    name: homebrew
    tasks_from: install

The fact that capitalizing the name field of include_role sidesteps this is unexpected, however, and should not be happening. There might be some overlap with the two name attributes that is causing trouble.

@Qalthos Qalthos removed the new Triage required label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Roadmap
Development

No branches or pull requests

2 participants