Debian Codegraph @

test/integration/targets/callback_default/test.yml

raw
1 ---
2 - hosts: testhost
3 gather_facts: no
4 vars:
5 foo: foo bar
6 tasks:
7 - name: Changed task
8 command: echo foo
9 changed_when: true
10 notify: test handlers
11
12 - name: Ok task
13 command: echo foo
14 changed_when: false
15
16 - name: Failed task
17 fail:
18 msg: no reason
19 ignore_errors: yes
20
21 - name: Skipped task
22 command: echo foo
23 when: false
24
25 - name: Task with var in name ({{ foo }})
26 command: echo foo
27
28 - name: Loop task
29 command: echo foo
30 loop:
31 - 1
32 - 2
33 - 3
34 loop_control:
35 label: foo-{{ item }}
36
37 # detect "changed" debug tasks being hidden with display_ok_tasks=false
38 - name: debug loop
39 debug:
40 msg: debug-{{ item }}
41 changed_when: item == 1
42 failed_when: item == 2
43 when: item != 4
44 ignore_errors: yes
45 loop:
46 - 1
47 - 2
48 - 3
49 - 4
50 loop_control:
51 label: debug-{{ item }}
52
53 - block:
54 - name: EXPECTED FAILURE Failed task to be rescued
55 fail:
56 rescue:
57 - name: Rescue task
58 command: echo rescued
59
60 - include_tasks: include_me.yml
61 loop:
62 - 1
63
64 - copy:
65 dest: '{{ lookup("env", "OUTPUT_DIR") }}/test_diff.txt'
66 content: foo
67
68 - replace:
69 path: '{{ lookup("env", "OUTPUT_DIR") }}/test_diff.txt'
70 regexp: '^foo$'
71 replace: bar
72 diff: true
73
74 - replace:
75 path: '{{ lookup("env", "OUTPUT_DIR") }}/test_diff.txt'
76 regexp: '^bar$'
77 replace: baz
78 diff: true
79 changed_when: false
80
81 - debug:
82 msg: "{{ item }}"
83 loop: []
84
85 - debug:
86 msg: "{{ item }}"
87 loop: "{{ empty_list }}"
88 vars:
89 empty_list: []
90
91 - debug:
92 msg: "{{ item }}"
93 when: False
94 loop:
95 - 1
96 - 2
97
98 - debug:
99 msg: "{{ _x }}"
100 loop:
101 - a
102 loop_control:
103 loop_var: _x
104
105 handlers:
106 - name: Test handler 1
107 command: echo foo
108 listen: test handlers
109
110 - name: Test handler 2
111 command: echo foo
112 changed_when: false
113 listen: test handlers
114
115 - name: Test handler 3
116 command: echo foo
117 listen: test handlers
118
119 # An issue was found previously for tasks in a play using strategy 'free' after
120 # a non-'free' play in the same playbook, so we protect against a regression.
121 - hosts: testhost
122 gather_facts: no
123 strategy: free
124 tasks:
125 - name: First free task
126 command: echo foo
127
128 - name: Second free task
129 command: echo foo
130
131 # Ensure include_tasks task names get shown (#71277)
132 - name: Include some tasks
133 include_tasks: include_me.yml
134 loop:
135 - 1