Added a 'set_up' and 'tear_down' which are like tasks, but execute before and after roles.

This commit is contained in:
Michael DeHaan
2013-04-20 16:07:06 -04:00
parent e6bf01a6b0
commit d7623d1f91
3 changed files with 37 additions and 1 deletions

View File

@@ -25,6 +25,12 @@
---
- hosts: all
set_up:
# set up tasks are executed prior to roles.
- local_action: shell echo "hi this is a setup step about {{ inventory_hostname }}"
roles:
# a role can be listed flat like this:
@@ -51,4 +57,11 @@
- shell: echo 'this is a loose task'
tear_down:
# just to provide a syntactic mirroring to 'set_up', tear_down runs dead last in the play.
- local_action: shell echo 'this is a teardown task about {{ inventory_hostname }}'