2015-02-26 15:51:12 +00:00
|
|
|
- hosts: all
|
|
|
|
gather_facts: yes
|
2015-02-09 22:54:44 +00:00
|
|
|
tasks:
|
|
|
|
- block:
|
2015-02-26 15:51:12 +00:00
|
|
|
- debug: msg="this is the first task"
|
|
|
|
- fail:
|
|
|
|
when: inventory_hostname == "l2"
|
|
|
|
- debug: msg="only l1 and l3 should see me"
|
2015-02-09 22:54:44 +00:00
|
|
|
rescue:
|
|
|
|
- debug: msg="this is the rescue"
|
|
|
|
- command: /bin/false
|
2015-02-26 15:51:12 +00:00
|
|
|
- debug: msg="no host should see this run"
|
2015-02-09 22:54:44 +00:00
|
|
|
always:
|
|
|
|
- debug: msg="this is the always block, it will always be seen"
|
|
|
|
when: foo|default('') != "some value"
|
|
|
|
tags:
|
|
|
|
- foo
|
|
|
|
- bar
|
2015-02-26 15:51:12 +00:00
|
|
|
- debug: msg="you should only see l1 and l3 run this"
|