Allow include statements from plays to specify tags (see tags.yml example file).

Also be smart and don't run a play at all if no tasks in the play match any of the tags specified.  This includes not running the setup actions!
This commit is contained in:
Michael DeHaan
2012-07-11 20:30:30 -04:00
parent 83f23ef861
commit 969c3feb13
4 changed files with 28 additions and 11 deletions

View File

@@ -3,27 +3,27 @@
#
# assume: ansible-playbook tags.yml --tags foo
#
# only tags with the given tags will be run when --tags is specified
# try this with:
# --tags foo
# --tags bar
#
# (an include statement will also be able to set tags on all included
# tasks at some point in the future)
# note the include syntax to tag all tasks included below
# it is a short hand over adding "tag:" to each task entry
- name: example play
- name: example play one
hosts: all
user: root
tasks:
- name: hi
tags: foo
action: shell echo "first play ran"
action: shell echo "first task ran"
- name: example play
- name: example play two
hosts: all
user: root
tasks:
- name: hi
tags: bar
action: shell echo "second play ran"
action: shell echo "second task ran"
- include: tasks/base.yml tags=base