Interview Prep/Ansible/Playbooks, Plays, Tasks and Handlers

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.

All Ansible questions Roadmap: Ansible

More on Playbooks, Plays, Tasks and Handlers