mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-04 00:01:30 -07:00
never tags docs and test (#35964)
* fufilling the promise * moved changes * Copy edit
This commit is contained in:
parent
c5dd0d97af
commit
0cf70a8970
3 changed files with 22 additions and 3 deletions
|
@ -129,11 +129,23 @@ Example::
|
||||||
tags:
|
tags:
|
||||||
- tag1
|
- tag1
|
||||||
|
|
||||||
There are another 3 special keywords for tags, ``tagged``, ``untagged`` and ``all``, which run only tagged, only untagged
|
.. versionadded:: 2.5
|
||||||
|
|
||||||
|
Another special tag is ``never``, which will prevent a task from running unless a tag is specifically requested.
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- debug: msg='{{ showmevar}}'
|
||||||
|
tags: [ 'never', 'debug' ]
|
||||||
|
|
||||||
|
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
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
|
|
@ -35,3 +35,7 @@ export LC_ALL=en_US.UTF-8
|
||||||
# Run a tag from a list of tags and always
|
# Run a tag from a list of tags and always
|
||||||
[ "$("${COMMAND[@]}" --tags café | grep -F Task_with | xargs)" = \
|
[ "$("${COMMAND[@]}" --tags café | grep -F Task_with | xargs)" = \
|
||||||
"Task_with_always_tag TAGS: [always] Task_with_list_of_tags TAGS: [café, press]" ]
|
"Task_with_always_tag TAGS: [always] Task_with_list_of_tags TAGS: [café, press]" ]
|
||||||
|
|
||||||
|
# Run tag with never
|
||||||
|
[ "$("${COMMAND[@]}" --tags donever | grep -F Task_with | xargs)" = \
|
||||||
|
"Task_with_always_tag TAGS: [always] Task_with_never_tag TAGS: [donever, never]" ]
|
||||||
|
|
|
@ -20,3 +20,6 @@
|
||||||
- press
|
- press
|
||||||
- name: Task_without_tag
|
- name: Task_without_tag
|
||||||
debug: msg=
|
debug: msg=
|
||||||
|
- name: Task_with_never_tag
|
||||||
|
debug: msg=NEVER
|
||||||
|
tags: ['never', 'donever']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue