Debian Codegraph @

test/integration/targets/omit/C75692.yml

raw
1 - hosts: localhost
2 gather_facts: false
3 tasks:
4 - name: Make sure foo is gone
5 file:
6 path: foo
7 state: absent
8 - name: Create foo - should only be changed in first iteration
9 copy:
10 dest: foo
11 content: foo
12 check_mode: '{{ omit }}'
13 register: cmode
14 loop:
15 - 1
16 - 2
17
18 - when: ansible_check_mode
19 block:
20 - name: stat foo
21 stat: path=foo
22 register: foo
23 check_mode: off
24 - debug: var=foo
25 - name: validate expected outcomes when in check mode and file does not exist
26 assert:
27 that:
28 - cmode['results'][0] is changed
29 - cmode['results'][1] is changed
30 when: not foo['stat']['exists']
31
32 - name: validate expected outcomes when in check mode and file exists
33 assert:
34 that:
35 - cmode['results'][0] is not changed
36 - cmode['results'][1] is not changed
37 when: foo['stat']['exists']
38
39 - name: validate expected outcomes when not in check mode (file is always deleted)
40 assert:
41 that:
42 - cmode['results'][0] is changed
43 - cmode['results'][1] is not changed
44 when: not ansible_check_mode