Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/win_iis_webbinding/tasks/http.yml

raw
1 #cm add
2 #changed true, check nothing present
3 - name: CM add http binding no header
4 win_iis_webbinding:
5 name: "{{ test_iis_site_name }}"
6 state: present
7 protocol: "{{ http_vars.protocol }}"
8 ip: "{{ http_vars.ip }}"
9 port: "{{ http_vars.port }}"
10 register: http_no_header
11 check_mode: yes
12
13 - name: CM get binding info no header
14 test_get_webbindings:
15 name: "{{ test_iis_site_name }}"
16 protocol: "{{ http_vars.protocol }}"
17 ip: "{{ http_vars.ip }}"
18 port: "{{ http_vars.port }}"
19 register: get_http_no_header
20 changed_when: false
21
22 - name: CM add http binding with header
23 win_iis_webbinding:
24 name: "{{ test_iis_site_name }}"
25 state: present
26 host_header: "{{ http_header_vars.header }}"
27 protocol: "{{ http_header_vars.protocol }}"
28 ip: "{{ http_header_vars.ip }}"
29 port: "{{ http_header_vars.port }}"
30 register: http_header
31 check_mode: yes
32
33 - name: CM get binding info header
34 test_get_webbindings:
35 name: "{{ test_iis_site_name }}"
36 host_header: "{{ http_header_vars.header }}"
37 protocol: "{{ http_header_vars.protocol }}"
38 ip: "{{ http_header_vars.ip }}"
39 port: "{{ http_header_vars.port }}"
40 register: get_http_header
41 changed_when: false
42
43 - name: CM assert changed, but not added
44 assert:
45 that:
46 - http_no_header is changed
47 - http_no_header.binding_info is none
48 - get_http_no_header.binding is not defined
49 - http_header is changed
50 - http_header.binding_info is none
51 - get_http_header.binding is not defined
52
53 #add
54 #changed true, new bindings present
55 - name: add http binding no header
56 win_iis_webbinding:
57 name: "{{ test_iis_site_name }}"
58 state: present
59 protocol: "{{ http_vars.protocol }}"
60 ip: "{{ http_vars.ip }}"
61 port: "{{ http_vars.port }}"
62 register: http_no_header
63
64 - name: get binding info no header
65 test_get_webbindings:
66 name: "{{ test_iis_site_name }}"
67 protocol: "{{ http_vars.protocol }}"
68 ip: "{{ http_vars.ip }}"
69 port: "{{ http_vars.port }}"
70 register: get_http_no_header
71 changed_when: false
72
73 - name: add http binding with header
74 win_iis_webbinding:
75 name: "{{ test_iis_site_name }}"
76 state: present
77 host_header: "{{ http_header_vars.header }}"
78 protocol: "{{ http_header_vars.protocol }}"
79 ip: "{{ http_header_vars.ip }}"
80 port: "{{ http_header_vars.port }}"
81 register: http_header
82
83 - name: get binding info header
84 test_get_webbindings:
85 name: "{{ test_iis_site_name }}"
86 host_header: "{{ http_header_vars.header }}"
87 protocol: "{{ http_header_vars.protocol }}"
88 ip: "{{ http_header_vars.ip }}"
89 port: "{{ http_header_vars.port }}"
90 register: get_http_header
91 changed_when: false
92
93 - name: assert changed and added
94 assert:
95 that:
96 - http_no_header is changed
97 - http_no_header.binding_info is defined
98 - http_no_header.operation_type == 'added'
99 - http_no_header.binding_info.ip == http_vars.ip
100 - http_no_header.binding_info.port == http_vars.port
101 - http_no_header.binding_info.protocol == http_vars.protocol
102 - http_header is changed
103 - http_header.binding_info is defined
104 - http_header.operation_type == 'added'
105 - http_header.binding_info.ip == http_header_vars.ip
106 - http_header.binding_info.port == http_header_vars.port
107 - http_header.binding_info.protocol == http_header_vars.protocol
108 - http_header.binding_info.hostheader == http_header_vars.header
109
110 #add idem
111 #changed false
112 - name: idem add http binding no header
113 win_iis_webbinding:
114 name: "{{ test_iis_site_name }}"
115 state: present
116 protocol: "{{ http_vars.protocol }}"
117 ip: "{{ http_vars.ip }}"
118 port: "{{ http_vars.port }}"
119 register: http_no_header
120
121 - name: idem add http binding with header
122 win_iis_webbinding:
123 name: "{{ test_iis_site_name }}"
124 state: present
125 host_header: "{{ http_header_vars.header }}"
126 protocol: "{{ http_header_vars.protocol }}"
127 ip: "{{ http_header_vars.ip }}"
128 port: "{{ http_header_vars.port }}"
129 register: http_header
130
131 - name: idem assert not changed
132 assert:
133 that:
134 - http_no_header is not changed
135 - http_header is not changed
136
137 #modify
138 #can't test modify for http, it will add a new binding instead since
139 #there's no way to match existing bindings against the new parameters
140
141 #cm remove
142 #changed true, bindings still present
143 - name: cm remove http binding no header
144 win_iis_webbinding:
145 name: "{{ test_iis_site_name }}"
146 state: absent
147 protocol: "{{ http_vars.protocol }}"
148 ip: "{{ http_vars.ip }}"
149 port: "{{ http_vars.port }}"
150 register: http_no_header
151 check_mode: yes
152
153 - name: get binding info no header
154 test_get_webbindings:
155 name: "{{ test_iis_site_name }}"
156 protocol: "{{ http_vars.protocol }}"
157 ip: "{{ http_vars.ip }}"
158 port: "{{ http_vars.port }}"
159 register: get_http_no_header
160 changed_when: false
161
162 - name: cm remove http binding with header
163 win_iis_webbinding:
164 name: "{{ test_iis_site_name }}"
165 state: absent
166 host_header: "{{ http_header_vars.header }}"
167 protocol: "{{ http_header_vars.protocol }}"
168 ip: "{{ http_header_vars.ip }}"
169 port: "{{ http_header_vars.port }}"
170 register: http_header
171 check_mode: yes
172
173 - name: get binding info header
174 test_get_webbindings:
175 name: "{{ test_iis_site_name }}"
176 host_header: "{{ http_header_vars.header }}"
177 protocol: "{{ http_header_vars.protocol }}"
178 ip: "{{ http_header_vars.ip }}"
179 port: "{{ http_header_vars.port }}"
180 register: get_http_header
181 changed_when: false
182
183 - name: cm remove assert changed, but still present
184 assert:
185 that:
186 - http_no_header is changed
187 - http_no_header.binding_info is defined
188 - http_no_header.operation_type == 'removed'
189 - http_no_header.binding_info.ip == http_vars.ip
190 - http_no_header.binding_info.port == http_vars.port
191 - http_no_header.binding_info.protocol == http_vars.protocol
192 - get_http_no_header.binding is defined
193 - get_http_no_header.binding.ip == http_vars.ip
194 - get_http_no_header.binding.port == http_vars.port
195 - get_http_no_header.binding.protocol == http_vars.protocol
196 - http_header is changed
197 - http_header.binding_info is defined
198 - http_header.operation_type == 'removed'
199 - http_header.binding_info.ip == http_header_vars.ip
200 - http_header.binding_info.port == http_header_vars.port
201 - http_header.binding_info.protocol == http_header_vars.protocol
202 - http_header.binding_info.hostheader == http_header_vars.header
203 - get_http_header.binding is defined
204 - get_http_header.binding.ip == http_header_vars.ip
205 - get_http_header.binding.port == http_header_vars.port
206 - get_http_header.binding.protocol == http_header_vars.protocol
207 - get_http_header.binding.hostheader == http_header_vars.header
208
209
210 #remove
211 #changed true, bindings gone
212 - name: remove http binding no header
213 win_iis_webbinding:
214 name: "{{ test_iis_site_name }}"
215 state: absent
216 protocol: "{{ http_vars.protocol }}"
217 ip: "{{ http_vars.ip }}"
218 port: "{{ http_vars.port }}"
219 register: http_no_header
220
221 - name: get binding info no header
222 test_get_webbindings:
223 name: "{{ test_iis_site_name }}"
224 protocol: "{{ http_vars.protocol }}"
225 ip: "{{ http_vars.ip }}"
226 port: "{{ http_vars.port }}"
227 register: get_http_no_header
228 changed_when: false
229
230 - name: remove http binding with header
231 win_iis_webbinding:
232 name: "{{ test_iis_site_name }}"
233 state: absent
234 host_header: "{{ http_header_vars.header }}"
235 protocol: "{{ http_header_vars.protocol }}"
236 ip: "{{ http_header_vars.ip }}"
237 port: "{{ http_header_vars.port }}"
238 register: http_header
239
240 - name: get binding info header
241 test_get_webbindings:
242 name: "{{ test_iis_site_name }}"
243 host_header: "{{ http_header_vars.header }}"
244 protocol: "{{ http_header_vars.protocol }}"
245 ip: "{{ http_header_vars.ip }}"
246 port: "{{ http_header_vars.port }}"
247 register: get_http_header
248 changed_when: false
249
250 - name: remove assert changed and gone
251 assert:
252 that:
253 - http_no_header is changed
254 - http_no_header.operation_type == 'removed'
255 - http_no_header.binding_info is defined
256 - http_no_header.binding_info.ip == http_vars.ip
257 - http_no_header.binding_info.port == http_vars.port
258 - http_no_header.binding_info.protocol == http_vars.protocol
259 - get_http_no_header.binding is not defined
260 - http_header is changed
261 - http_header.binding_info is defined
262 - http_header.operation_type == 'removed'
263 - http_header.binding_info.ip == http_header_vars.ip
264 - http_header.binding_info.port == http_header_vars.port
265 - http_header.binding_info.protocol == http_header_vars.protocol
266 - http_header.binding_info.hostheader == http_header_vars.header
267 - get_http_header.binding is not defined
268
269 #remove idem
270 #change false, bindings gone
271 - name: idem remove http binding no header
272 win_iis_webbinding:
273 name: "{{ test_iis_site_name }}"
274 state: absent
275 protocol: "{{ http_vars.protocol }}"
276 ip: "{{ http_vars.ip }}"
277 port: "{{ http_vars.port }}"
278 register: http_no_header
279
280 - name: get binding info no header
281 test_get_webbindings:
282 name: "{{ test_iis_site_name }}"
283 protocol: "{{ http_vars.protocol }}"
284 ip: "{{ http_vars.ip }}"
285 port: "{{ http_vars.port }}"
286 register: get_http_no_header
287 changed_when: false
288
289 - name: idem remove http binding with header
290 win_iis_webbinding:
291 name: "{{ test_iis_site_name }}"
292 state: absent
293 host_header: "{{ http_header_vars.header }}"
294 protocol: "{{ http_header_vars.protocol }}"
295 ip: "{{ http_header_vars.ip }}"
296 port: "{{ http_header_vars.port }}"
297 register: http_header
298
299 - name: get binding info header
300 test_get_webbindings:
301 name: "{{ test_iis_site_name }}"
302 host_header: "{{ http_header_vars.header }}"
303 protocol: "{{ http_header_vars.protocol }}"
304 ip: "{{ http_header_vars.ip }}"
305 port: "{{ http_header_vars.port }}"
306 register: get_http_header
307 changed_when: false
308
309 - name: idem remove assert changed and gone
310 assert:
311 that:
312 - http_no_header is not changed
313 - http_no_header.binding_info is not defined
314 - get_http_no_header.binding is not defined
315 - http_header is not changed
316 - http_header.binding_info is not defined
317 - get_http_header.binding is not defined