Previewing the results of using tags
When you run a role or playbook, you might not know or remember which tasks have which tags, or which tags exist at all. Ansible offers two command-line flags foransible-playbookthat help you manage tagged playbooks:
--list-tags- generate a list of available tags--list-tasks- when used with--tagstagnameor--skip-tagstagname, generate a preview of tagged tasks
For example, if you do not know whether the tag for configuration tasks isconfigorconfin a playbook, role, or tasks file, you can display all available tags without running any tasks:
If you do not know which tasks have the tagsconfigurationandpackages, you can pass those tags and add--list-tasks. Ansible lists the tasks but does not execute any of them.
These command-line flags have one limitation: they cannot show tags or tasks within dynamically included files or roles. SeeComparing includes and imports: dynamic and static reusefor more information on differences between static imports and dynamic includes.