Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/win_iis_webbinding/tasks/https-ge6.2.yml

raw
1 ##############
2 ### CM Add ###
3 ##############
4 #changed true, check nothing present
5 - name: CM add https binding no header
6 win_iis_webbinding:
7 name: "{{ test_iis_site_name }}"
8 state: present
9 protocol: "{{ https_vars.protocol }}"
10 ip: "{{ https_vars.ip }}"
11 port: "{{ https_vars.port }}"
12 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
13 register: https_no_header
14 check_mode: yes
15
16 - name: CM get binding info no header
17 test_get_webbindings:
18 name: "{{ test_iis_site_name }}"
19 protocol: "{{ https_vars.protocol }}"
20 ip: "{{ https_vars.ip }}"
21 port: "{{ https_vars.port }}"
22 register: get_https_no_header
23 changed_when: false
24
25 - name: CM add https binding with header and SNI
26 win_iis_webbinding:
27 name: "{{ test_iis_site_name }}"
28 state: present
29 host_header: "{{ https_header_vars.header }}"
30 protocol: "{{ https_header_vars.protocol }}"
31 ip: "{{ https_header_vars.ip }}"
32 port: "{{ https_header_vars.port }}"
33 ssl_flags: 1
34 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
35 register: https_header
36 check_mode: yes
37
38 - name: CM get binding info header
39 test_get_webbindings:
40 name: "{{ test_iis_site_name }}"
41 host_header: "{{ https_header_vars.header }}"
42 protocol: "{{ https_header_vars.protocol }}"
43 ip: "{{ https_header_vars.ip }}"
44 port: "{{ https_header_vars.port }}"
45 register: get_https_header
46 changed_when: false
47
48 - name: CM assert changed, but not added
49 assert:
50 that:
51 - https_no_header is changed
52 - https_no_header.operation_type == 'added'
53 - https_no_header.binding_info is none
54 - get_https_no_header.binding is not defined
55 - https_header is changed
56 - https_header.operation_type == 'added'
57 - https_header.binding_info is none
58 - get_https_header.binding is not defined
59
60 ###########
61 ### Add ###
62 ###########
63 #changed true, new bindings present
64 - name: add https binding no header
65 win_iis_webbinding:
66 name: "{{ test_iis_site_name }}"
67 state: present
68 protocol: "{{ https_vars.protocol }}"
69 ip: "{{ https_vars.ip }}"
70 port: "{{ https_vars.port }}"
71 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
72 register: https_no_header
73
74 - name: get binding info no header
75 test_get_webbindings:
76 name: "{{ test_iis_site_name }}"
77 protocol: "{{ https_vars.protocol }}"
78 ip: "{{ https_vars.ip }}"
79 port: "{{ https_vars.port }}"
80 register: get_https_no_header
81 changed_when: false
82
83 - name: add https binding with header SNI
84 win_iis_webbinding:
85 name: "{{ test_iis_site_name }}"
86 state: present
87 host_header: "{{ https_header_vars.header }}"
88 protocol: "{{ https_header_vars.protocol }}"
89 ip: "{{ https_header_vars.ip }}"
90 port: "{{ https_header_vars.port }}"
91 ssl_flags: 1
92 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
93 register: https_header
94
95 - name: get binding info header
96 test_get_webbindings:
97 name: "{{ test_iis_site_name }}"
98 host_header: "{{ https_header_vars.header }}"
99 protocol: "{{ https_header_vars.protocol }}"
100 ip: "{{ https_header_vars.ip }}"
101 port: "{{ https_header_vars.port }}"
102 register: get_https_header
103 changed_when: false
104
105 - name: assert changed and added
106 assert:
107 that:
108 - https_no_header is changed
109 - https_no_header.operation_type == 'added'
110 - https_no_header.binding_info is defined
111 - https_no_header.binding_info.protocol == https_vars.protocol
112 - https_no_header.binding_info.ip == https_vars.ip
113 - https_no_header.binding_info.port == https_vars.port
114 - https_no_header.binding_info.hostheader == ''
115 - https_no_header.binding_info.certificateHash == thumbprint1.stdout_lines[0]
116 - https_header is changed
117 - https_header.operation_type == 'added'
118 - https_header.binding_info is defined
119 - https_header.binding_info.hostheader == https_header_vars.header
120 - https_header.binding_info.protocol == https_header_vars.protocol
121 - https_header.binding_info.ip == https_header_vars.ip
122 - https_header.binding_info.port == https_header_vars.port
123 - https_header.binding_info.certificateHash == thumbprint1.stdout_lines[0]
124 - https_header.binding_info.sslFlags == 1
125
126 ################
127 ### Idem Add ###
128 ################
129 #changed false
130 - name: idem add https binding no header
131 win_iis_webbinding:
132 name: "{{ test_iis_site_name }}"
133 state: present
134 protocol: https
135 ip: '*'
136 port: 443
137 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
138 register: https_no_header
139
140 - name: idem add https binding with header and SNI
141 win_iis_webbinding:
142 name: "{{ test_iis_site_name }}"
143 state: present
144 host_header: test.com
145 protocol: https
146 ip: '*'
147 port: 443
148 ssl_flags: 1
149 certificate_hash: "{{ thumbprint1.stdout_lines[0] }}"
150 register: https_header
151
152 - name: idem assert not changed
153 assert:
154 that:
155 - https_no_header is not changed
156 - https_header is not changed
157
158 #################
159 ### CM Modify ###
160 #################
161 # changed true, verify no changes occurred
162
163 #modify sni
164 - name: CM modify https binding with header, change cert
165 win_iis_webbinding:
166 name: "{{ test_iis_site_name }}"
167 state: present
168 host_header: "{{ https_header_vars.header }}"
169 protocol: "{{ https_header_vars.protocol }}"
170 ip: "{{ https_header_vars.ip }}"
171 port: "{{ https_header_vars.port }}"
172 ssl_flags: 1
173 certificate_hash: "{{ thumbprint2.stdout_lines[0] }}"
174 register: https_header
175 check_mode: yes
176
177 - name: get binding info header
178 test_get_webbindings:
179 name: "{{ test_iis_site_name }}"
180 host_header: "{{ https_header_vars.header }}"
181 protocol: "{{ https_header_vars.protocol }}"
182 ip: "{{ https_header_vars.ip }}"
183 port: "{{ https_header_vars.port }}"
184 register: get_https_header
185 changed_when: false
186
187 - name: CM assert changed but old cert
188 assert:
189 that:
190 - https_header is changed
191 - https_header.operation_type == 'updated'
192 - https_header.binding_info is defined
193 - https_header.binding_info.ip == https_header_vars.ip
194 - https_header.binding_info.port == https_header_vars.port
195 - https_header.binding_info.protocol == https_header_vars.protocol
196 - https_header.binding_info.hostheader == https_header_vars.header
197 - https_header.binding_info.certificateHash == thumbprint1.stdout_lines[0]
198 - https_header.binding_info.sslFlags == 1
199 - get_https_header.binding is defined
200 - get_https_header.binding.ip == https_header_vars.ip
201 - get_https_header.binding.port == https_header_vars.port
202 - get_https_header.binding.protocol == https_header_vars.protocol
203 - get_https_header.binding.hostheader == https_header_vars.header
204 - get_https_header.binding.certificateHash == thumbprint1.stdout_lines[0]
205 - get_https_header.binding.sslFlags == 1
206
207 ##############
208 ### Modify ###
209 ##############
210 # modify ssl flags
211 - name: modify https binding with header, change cert
212 win_iis_webbinding:
213 name: "{{ test_iis_site_name }}"
214 state: present
215 host_header: "{{ https_header_vars.header }}"
216 protocol: "{{ https_header_vars.protocol }}"
217 ip: "{{ https_header_vars.ip }}"
218 port: "{{ https_header_vars.port }}"
219 ssl_flags: 1
220 certificate_hash: "{{ thumbprint2.stdout_lines[0] }}"
221 register: https_header
222
223 - name: get binding info header
224 test_get_webbindings:
225 name: "{{ test_iis_site_name }}"
226 host_header: "{{ https_header_vars.header }}"
227 protocol: "{{ https_header_vars.protocol }}"
228 ip: "{{ https_header_vars.ip }}"
229 port: "{{ https_header_vars.port }}"
230 register: get_https_header
231 changed_when: false
232
233 - name: modify assert changed and new cert
234 assert:
235 that:
236 - https_header is changed
237 - https_header.operation_type == 'updated'
238 - https_header.binding_info is defined
239 - https_header.binding_info.ip == https_header_vars.ip
240 - https_header.binding_info.port == https_header_vars.port
241 - https_header.binding_info.protocol == https_header_vars.protocol
242 - https_header.binding_info.hostheader == https_header_vars.header
243 - https_header.binding_info.certificateHash == thumbprint2.stdout_lines[0]
244 - https_header.binding_info.sslFlags == 1
245 - get_https_header.binding is defined
246 - get_https_header.binding.ip == https_header_vars.ip
247 - get_https_header.binding.port == https_header_vars.port
248 - get_https_header.binding.protocol == https_header_vars.protocol
249 - get_https_header.binding.hostheader == https_header_vars.header
250 - get_https_header.binding.certificateHash == thumbprint2.stdout_lines[0]
251 - get_https_header.binding.sslFlags == 1
252
253 ###################
254 ### Idem Modify ###
255 ###################
256 #changed false
257
258 #idem modify ssl flags
259 - name: idem modify https binding with header, enable SNI and change cert
260 win_iis_webbinding:
261 name: "{{ test_iis_site_name }}"
262 state: present
263 host_header: "{{ https_header_vars.header }}"
264 protocol: "{{ https_header_vars.protocol }}"
265 ip: "{{ https_header_vars.ip }}"
266 port: "{{ https_header_vars.port }}"
267 ssl_flags: 1
268 certificate_hash: "{{ thumbprint2.stdout_lines[0] }}"
269 register: https_header
270
271 - name: idem assert not changed
272 assert:
273 that:
274 - https_header is not changed
275
276 #################
277 ### CM Remove ###
278 #################
279 #changed true, bindings still present
280 - name: cm remove https binding no header
281 win_iis_webbinding:
282 name: "{{ test_iis_site_name }}"
283 state: absent
284 protocol: "{{ https_vars.protocol }}"
285 ip: "{{ https_vars.ip }}"
286 port: "{{ https_vars.port }}"
287 register: https_no_header
288 check_mode: yes
289
290 - name: get binding info no header
291 test_get_webbindings:
292 name: "{{ test_iis_site_name }}"
293 protocol: "{{ https_vars.protocol }}"
294 ip: "{{ https_vars.ip }}"
295 port: "{{ https_vars.port }}"
296 register: get_https_no_header
297 changed_when: false
298
299 - name: cm remove https binding with header
300 win_iis_webbinding:
301 name: "{{ test_iis_site_name }}"
302 state: absent
303 host_header: "{{ https_header_vars.header }}"
304 protocol: "{{ https_header_vars.protocol }}"
305 ip: "{{ https_header_vars.ip }}"
306 port: "{{ https_header_vars.port }}"
307 register: https_header
308 check_mode: yes
309
310 - name: get binding info header
311 test_get_webbindings:
312 name: "{{ test_iis_site_name }}"
313 host_header: "{{ https_header_vars.header }}"
314 protocol: "{{ https_header_vars.protocol }}"
315 ip: "{{ https_header_vars.ip }}"
316 port: "{{ https_header_vars.port }}"
317 register: get_https_header
318 changed_when: false
319
320 - name: cm remove assert changed, but still present
321 assert:
322 that:
323 - https_no_header is changed
324 - https_no_header.operation_type == 'removed'
325 - https_no_header.binding_info is defined
326 - https_no_header.binding_info.ip == https_vars.ip
327 - https_no_header.binding_info.port == https_vars.port
328 - https_no_header.binding_info.protocol == https_vars.protocol
329 - get_https_no_header.binding is defined
330 - get_https_no_header.binding.ip == https_vars.ip
331 - get_https_no_header.binding.port == https_vars.port
332 - get_https_no_header.binding.protocol == https_vars.protocol
333 - get_https_no_header.binding.certificateHash == thumbprint1.stdout_lines[0]
334 - https_header is changed
335 - https_header.binding_info is defined
336 - https_header.operation_type == 'removed'
337 - https_header.binding_info.ip == https_header_vars.ip
338 - https_header.binding_info.port == https_header_vars.port
339 - https_header.binding_info.protocol == https_header_vars.protocol
340 - https_header.binding_info.hostheader == https_header_vars.header
341 - get_https_header.binding is defined
342 - get_https_header.binding.ip == https_header_vars.ip
343 - get_https_header.binding.port == https_header_vars.port
344 - get_https_header.binding.protocol == https_header_vars.protocol
345 - get_https_header.binding.hostheader == https_header_vars.header
346 - get_https_header.binding.certificateHash == thumbprint2.stdout_lines[0]
347
348 ##############
349 ### remove ###
350 ##############
351 #changed true, bindings gone
352 - name: remove https binding no header
353 win_iis_webbinding:
354 name: "{{ test_iis_site_name }}"
355 state: absent
356 protocol: "{{ https_vars.protocol }}"
357 ip: "{{ https_vars.ip }}"
358 port: "{{ https_vars.port }}"
359 register: https_no_header
360
361 - name: get binding info no header
362 test_get_webbindings:
363 name: "{{ test_iis_site_name }}"
364 protocol: "{{ https_vars.protocol }}"
365 ip: "{{ https_vars.ip }}"
366 port: "{{ https_vars.port }}"
367 register: get_https_no_header
368 changed_when: false
369
370 - name: remove https binding with header
371 win_iis_webbinding:
372 name: "{{ test_iis_site_name }}"
373 state: absent
374 host_header: "{{ https_header_vars.header }}"
375 protocol: "{{ https_header_vars.protocol }}"
376 ip: "{{ https_header_vars.ip }}"
377 port: "{{ https_header_vars.port }}"
378 register: https_header
379
380 - name: get binding info header
381 test_get_webbindings:
382 name: "{{ test_iis_site_name }}"
383 host_header: "{{ https_header_vars.header }}"
384 protocol: "{{ https_header_vars.protocol }}"
385 ip: "{{ https_header_vars.ip }}"
386 port: "{{ https_header_vars.port }}"
387 register: get_https_header
388 changed_when: false
389
390 - name: remove assert changed and gone
391 assert:
392 that:
393 - https_no_header is changed
394 - https_no_header.binding_info is defined
395 - https_no_header.operation_type == 'removed'
396 - https_no_header.binding_info.ip == https_vars.ip
397 - https_no_header.binding_info.port == https_vars.port
398 - https_no_header.binding_info.protocol == https_vars.protocol
399 - get_https_no_header.binding is not defined
400 - https_header is changed
401 - https_header.binding_info is defined
402 - https_header.operation_type == 'removed'
403 - https_header.binding_info.ip == https_header_vars.ip
404 - https_header.binding_info.port == https_header_vars.port
405 - https_header.binding_info.protocol == https_header_vars.protocol
406 - https_header.binding_info.hostheader == https_header_vars.header
407 - get_https_header.binding is not defined
408
409 ###################
410 ### remove idem ###
411 ###################
412 #change false, bindings gone
413 - name: idem remove https binding no header
414 win_iis_webbinding:
415 name: "{{ test_iis_site_name }}"
416 state: absent
417 protocol: "{{ https_vars.protocol }}"
418 ip: "{{ https_vars.ip }}"
419 port: "{{ https_vars.port }}"
420 register: https_no_header
421
422 - name: get binding info no header
423 test_get_webbindings:
424 name: "{{ test_iis_site_name }}"
425 protocol: "{{ https_vars.protocol }}"
426 ip: "{{ https_vars.ip }}"
427 port: "{{ https_vars.port }}"
428 register: get_https_no_header
429 changed_when: false
430
431 - name: idem remove https binding with header
432 win_iis_webbinding:
433 name: "{{ test_iis_site_name }}"
434 state: absent
435 host_header: "{{ https_header_vars.header }}"
436 protocol: "{{ https_header_vars.protocol }}"
437 ip: "{{ https_header_vars.ip }}"
438 port: "{{ https_header_vars.port }}"
439 register: https_header
440
441 - name: get binding info header
442 test_get_webbindings:
443 name: "{{ test_iis_site_name }}"
444 host_header: "{{ https_header_vars.header }}"
445 protocol: "{{ https_header_vars.protocol }}"
446 ip: "{{ https_header_vars.ip }}"
447 port: "{{ https_header_vars.port }}"
448 register: get_https_header
449 changed_when: false
450
451 - name: idem remove assert changed and gone
452 assert:
453 that:
454 - https_no_header is not changed
455 - https_no_header.binding_info is not defined
456 - get_https_no_header.binding is not defined
457 - https_header is not changed
458 - https_header.binding_info is not defined
459 - get_https_header.binding is not defined