ansible/examples/playbooks/tags.yml
Michael DeHaan 969c3feb13 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!
2012-07-11 20:33:46 -04:00

29 lines
575 B
YAML

---
# tags allow us to run all of a playbook or part of it.
#
# assume: ansible-playbook tags.yml --tags foo
#
# try this with:
# --tags foo
# --tags bar
#
# 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 one
hosts: all
user: root
tasks:
- name: hi
tags: foo
action: shell echo "first task ran"
- name: example play two
hosts: all
user: root
tasks:
- name: hi
tags: bar
action: shell echo "second task ran"
- include: tasks/base.yml tags=base