samples/test_block.yml
4af2d0a9
 - hosts: all
   gather_facts: yes
31dd75de
   tasks:
   - block:
4af2d0a9
       - debug: msg="this is the first task"
       - fail:
         when: inventory_hostname == "l2"
       - debug: msg="only l1 and l3 should see me"
31dd75de
     rescue:
       - debug: msg="this is the rescue"
       - command: /bin/false
4af2d0a9
       - debug: msg="no host should see this run"
31dd75de
     always:
       - debug: msg="this is the always block, it will always be seen"
     when: foo|default('') != "some value"
     tags:
       - foo
       - bar
4af2d0a9
   - debug: msg="you should only see l1 and l3 run this"