summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/blocks/block_in_rescue.yml
blob: 15360304b538a53a8ee205d0915d807d94302bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
- hosts: localhost
  gather_facts: no
  tasks:
    - block:
        - name: "EXPECTED FAILURE"
          fail:
            msg: "fail to test single level block in rescue"
      rescue:
        - block:
          - debug:
              msg: Rescued!

    - block:
        - name: "EXPECTED FAILURE"
          fail:
            msg: "fail to test multi-level block in rescue"
      rescue:
        - block:
          - block:
            - debug:
                msg: Rescued!

    - name: "Outer block"
      block:
        - name: "Inner block"
          block:
            - name: "EXPECTED FAILURE"
              fail:
                msg: "fail to test multi-level block"
          rescue:
            - name: "Rescue block"
              block:
                - debug: msg="Inner block rescue"