Skip to content

Ambiguous documentation on play and role level tags #2972

@richlv

Description

@richlv

Summary

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html#adding-tags-to-includes is very clear about how the tags will affect it:

tags on an include_* task apply only to the include itself, not to any tasks within the included file or role

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html#adding-tags-to-plays says:

If all the tasks in a play should get the same tag, you can add the tag at the level of the play.

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html#adding-tags-to-roles says:

When you incorporate a role in your playbook statically with the roles keyword, Ansible adds any tags you define to all the tasks in the role.

In both of these cases it is not explicitly documented whether and how tagging will apply to the definition itself and/or it's downstream tasks.

Ideally, documentation would allow to clearly determine the following.
If a tag is included for a play or a role:
a) Is it run if no tags are specified?
b) Is the tag passed down to all the tasks?

Issue Type

Documentation Report

Component Name

tags

Ansible Version

$ ansible --version

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

OS / Environment

Not relevant.

Additional Information

Users could unambiguously determine the behaviour just from reading the documentation.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    new_contributorThis PR is the first contribution by a new community member.

    Type

    No type

    Projects

    Status

    🆕 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions