* Fact gathering is tagged with 'always' by default. It is ONLY skipped if you apply a tag and then use a different tag in ``--tags`` or the same tag in ``--skip-tags``.
* Fact gathering is tagged with 'always' by default. It is ONLY skipped if
you apply a tag and then use a different tag in ``--tags`` or the same
tag in ``--skip-tags``.
.._tag_reuse:
.._tag_reuse:
@ -129,14 +138,16 @@ Tags are applied *down* the dependency chain. In order for a tag to be
inherited to a dependent role's tasks, the tag should be applied to the
inherited to a dependent role's tasks, the tag should be applied to the
role declaration or static import, not to all the tasks within the role.
role declaration or static import, not to all the tasks within the role.
There is no way to 'import only these tags'; you probably want to split into smaller roles/includes if you find yourself looking for such a feature.
There is no way to 'import only these tags'; you probably want to split
into smaller roles/includes if you find yourself looking for such a feature.
The above information does not apply to `include_tasks` or other dynamic includes,
The above information does not apply to `include_tasks` or other dynamic
as the attributes applied to an include, only affect the include itself.
includes, as the attributes applied to an include, only affect the include
itself.
You can see which tags are applied to tasks, roles, and static imports
You can see which tags are applied to tasks, roles, and static imports
by running ``ansible-playbook`` with the ``--list-tasks`` option. You can
by running ``ansible-playbook`` with the ``--list-tasks`` option. You can
display all tags applied to the tasks with the ``--list-tags`` option.
display all tags available with the ``--list-tags`` option.
..note::
..note::
The above information does not apply to `include_tasks`, `include_roles`,
The above information does not apply to `include_tasks`, `include_roles`,
@ -175,7 +186,8 @@ Role tasks file::
Special Tags
Special Tags
````````````
````````````
There is a special ``always`` tag that will always run a task, unless specifically skipped (``--skip-tags always``)
There is a special ``always`` tag that will always run a task, unless
specifically skipped (``--skip-tags always``)
Example::
Example::
@ -192,7 +204,8 @@ Example::
..versionadded:: 2.5
..versionadded:: 2.5
Another special tag is ``never``, which will prevent a task from running unless a tag is specifically requested.
Another special tag is ``never``, which will prevent a task from running unless
a tag is specifically requested.
Example::
Example::
@ -200,10 +213,12 @@ Example::
- debug: msg="{{ showmevar }}"
- debug: msg="{{ showmevar }}"
tags: [ never, debug ]
tags: [ never, debug ]
In this example, the task will only run when the ``debug`` or ``never`` tag is explicitly requested.
In this example, the task will only run when the ``debug`` or ``never`` tag
is explicitly requested.
There are another 3 special keywords for tags: ``tagged``, ``untagged`` and ``all``, which run only tagged, only untagged
There are another 3 special keywords for tags: ``tagged``, ``untagged`` and
``all``, which run only tagged, only untagged
and all tasks respectively.
and all tasks respectively.
By default, Ansible runs as if ``--tags all`` had been specified.
By default, Ansible runs as if ``--tags all`` had been specified.