Why should every task have a `name`?
BeginnerConceptPlaybooks, Plays, Tasks and Handlers
Answer
The name is what you see in the run output (TASK [Install nginx]), in logs, in AWX job views and in --list-tasks. Without one you get a module name and arguments, which is hard to read, and --start-at-task cannot target the task. Handler names are also how notify finds them.
ansible-lint flags unnamed tasks. Names should say what the task achieves, starting with a capital letter and a verb.
More on Playbooks, Plays, Tasks and Handlers
What is a playbook?BeginnerWhat are the main keys of a play?BeginnerWhich playbook flags help you inspect and debug before a real run?BeginnerWhat is a handler and how is it triggered?BeginnerWhat are the behaviours and gotchas of handlers?IntermediateHow do you run handlers immediately instead of at the end of the play?Intermediate