From af573db47a11586197694125d9168fa54920579a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 12 Feb 2015 21:15:44 -0500 Subject: [PATCH] documented new tag behaviour --- docsite/rst/playbooks_tags.rst | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docsite/rst/playbooks_tags.rst b/docsite/rst/playbooks_tags.rst index 308d451c88..01c4f6fa2b 100644 --- a/docsite/rst/playbooks_tags.rst +++ b/docsite/rst/playbooks_tags.rst @@ -1,8 +1,8 @@ Tags ==== -If you have a large playbook it may become useful to be able to run a -specific part of the configuration without running the whole playbook. +If you have a large playbook it may become useful to be able to run a +specific part of the configuration without running the whole playbook. Both plays and tasks support a "tags:" attribute for this reason. @@ -24,7 +24,7 @@ Example:: If you wanted to just run the "configuration" and "packages" part of a very long playbook, you could do this:: ansible-playbook example.yml --tags "configuration,packages" - + On the other hand, if you want to run a playbook *without* certain tasks, you could do this:: ansible-playbook example.yml --skip-tags "notification" @@ -40,6 +40,28 @@ And you may also tag basic include statements:: Both of these have the function of tagging every single task inside the include statement. + +Special Tags +```````````` + +There is a special 'always' tag that will always run a task, unless specifically skipped (--skip-tags always) + +Example:: + + tasks: + + - debug: msg="Always runs" + tags: + - always + + - debug: msg="runs when you use tag1" + tags: + - tag1 + +There are another 3 special keywords for tags, 'tagged', 'untagged' and 'all', which run only tagged, only untagged +and all tasks respectively. By default ansible runs as if --tags all had been specified. + + .. seealso:: :doc:`playbooks`