Debian Codegraph @

ansible_collections/microsoft/iis/tests/integration/targets/web_app_pool/tasks/tests.yml

raw symbols SCIP
1 ---
2 - name: create default pool check
3 web_app_pool:
4 name: '{{test_iis_webapppool_name}}'
5 state: started
6 register: create_default_check
7 check_mode: yes
8
9 - name: get actual of create default pool check
10 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}"
11 register: create_default_actual_check
12 failed_when: False
13
14 - name: assert create default pool check
15 assert:
16 that:
17 - create_default_check is changed
18 - create_default_actual_check.rc == 1
19
20 - name: create default pool
21 web_app_pool:
22 name: '{{test_iis_webapppool_name}}'
23 state: present
24 register: create_default
25
26 - name: get actual of create default pool
27 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}"
28 register: create_default_actual
29 failed_when: False
30
31 - name: get info of created web application pool
32 web_app_pool_info:
33 name: '{{test_iis_webapppool_name}}'
34 register: web_app_pool_info
35
36 - name: assert create default pool
37 assert:
38 that:
39 - create_default is changed
40 - create_default_actual.rc == 0
41 - web_app_pool_info.app_pools[0].attributes.name == test_iis_webapppool_name
42 - web_app_pool_info.app_pools[0].attributes.startMode == 'OnDemand'
43 - web_app_pool_info.app_pools[0].attributes.state == 'Started'
44
45 - name: change attributes of pool in check mode
46 web_app_pool:
47 name: '{{test_iis_webapppool_name}}'
48 state: present
49 attributes:
50 managedPipelineMode: 1 # Using an enum value
51 cpu.limit: 95 # Nested values
52 processModel.identityType: LocalSystem # Using an enum name
53 processModel.loadUserProfile: True
54 register: change_pool_attributes_check
55 check_mode: yes
56
57 - name: get info of changed web application pool
58 web_app_pool_info:
59 name: '{{test_iis_webapppool_name}}'
60 register: web_app_pool_changed_info
61
62 # Since check-mode was used we expect no changes
63 - name: assert change attributes of pool in check mode
64 assert:
65 that:
66 - change_pool_attributes_check is changed
67 - web_app_pool_info.app_pools[0].attributes == web_app_pool_changed_info.app_pools[0].attributes
68
69 - name: change attributes of pool
70 web_app_pool:
71 name: '{{test_iis_webapppool_name}}'
72 state: present
73 attributes:
74 managedPipelineMode: 1 # Using an enum value
75 cpu.limit: 95 # Nested values
76 processModel.identityType: LocalSystem # Using an enum name
77 processModel.loadUserProfile: True
78 register: change_pool_attributes
79
80 - name: get info of changed web application pool without check-mode
81 web_app_pool_info:
82 name: '{{test_iis_webapppool_name}}'
83 register: web_app_pool_changed_info
84
85 - name: assert change attributes of pool
86 assert:
87 that:
88 - change_pool_attributes is changed
89 - web_app_pool_changed_info.app_pools[0].attributes.managedPipelineMode == 'Classic'
90 - web_app_pool_changed_info.app_pools[0].attributes.cpu.limit == 95
91 - web_app_pool_changed_info.app_pools[0].attributes.processModel.identityType == 'LocalSystem'
92 - web_app_pool_changed_info.app_pools[0].attributes.processModel.loadUserProfile == True
93
94 - name: change attributes of pool again
95 web_app_pool:
96 name: '{{test_iis_webapppool_name}}'
97 state: present
98 attributes:
99 managedPipelineMode: 1 # Using an enum value
100 cpu.limit: 95 # Nested values
101 processModel.identityType: LocalSystem # Using an enum name
102 processModel.loadUserProfile: True
103 register: change_pool_attributes_again
104
105 - name: get info of changed web application pool again
106 web_app_pool_info:
107 name: '{{test_iis_webapppool_name}}'
108 register: web_app_pool_changed_info_again
109
110 - name: assert change attributes of pool again
111 assert:
112 that:
113 - change_pool_attributes_again is not changed
114 - web_app_pool_changed_info_again.app_pools[0].attributes == web_app_pool_changed_info.app_pools[0].attributes
115
116 - name: change more complex variables check
117 web_app_pool:
118 name: '{{test_iis_webapppool_name}}'
119 state: present
120 attributes:
121 queueLength: 500
122 recycling.periodicRestart.requests: 10 # Deeply nested attribute
123 recycling.periodicRestart.time: "00:00:05:00.000000" # Timespan with string
124 processModel.pingResponseTime: "00:03:00" # Timespan without days or milliseconds
125 register: change_complex_attributes_check
126 check_mode: yes
127
128 - name: get info of changed web application pool complex
129 web_app_pool_info:
130 name: '{{test_iis_webapppool_name}}'
131 register: web_app_pool_changed_info_complex
132
133 - name: assert change more complex variables check
134 assert:
135 that:
136 - change_complex_attributes_check is changed
137 - web_app_pool_changed_info_complex.app_pools[0].attributes == web_app_pool_changed_info_again.app_pools[0].attributes
138
139 - name: change more complex variables
140 web_app_pool:
141 name: '{{test_iis_webapppool_name}}'
142 state: present
143 attributes:
144 queueLength: 500
145 recycling.periodicRestart.requests: 10 # Deeply nested attribute
146 recycling.periodicRestart.time: "00:00:05:00.000000" # Timespan with string
147 processModel.pingResponseTime: "00:03:00" # Timespan without days or milliseconds
148 register: change_complex_attributes
149
150 - name: get info of changed web application pool complex without check
151 web_app_pool_info:
152 name: '{{test_iis_webapppool_name}}'
153 register: web_app_pool_changed_info_complex_again
154
155 - name: assert change more complex variables
156 assert:
157 that:
158 - change_complex_attributes is changed
159 - web_app_pool_changed_info_complex_again.app_pools[0].attributes.queueLength == 500
160 - web_app_pool_changed_info_complex_again.app_pools[0].attributes.recycling.periodicRestart.requests == 10
161 - web_app_pool_changed_info_complex_again.app_pools[0].attributes.recycling.periodicRestart.time == "00:05:00"
162
163 - name: change more complex variables again
164 web_app_pool:
165 name: '{{test_iis_webapppool_name}}'
166 state: present
167 attributes:
168 queueLength: 500
169 recycling.periodicRestart.requests: 10 # Deeply nested attribute
170 recycling.periodicRestart.time: "00:00:05:00.000000" # Timespan with string
171 processModel.pingResponseTime: "00:03:00" # Timespan without days or milliseconds
172 register: change_complex_attributes_again
173
174 - name: get info of changed web application pool complex without check
175 web_app_pool_info:
176 name: '{{test_iis_webapppool_name}}'
177 register: change_complex_attributes_again_info
178
179 - name: assert change more complex variables again
180 assert:
181 that:
182 - change_complex_attributes_again is not changed
183 - change_complex_attributes_again_info.app_pools[0].attributes == web_app_pool_changed_info_complex_again.app_pools[0].attributes
184
185 - name: stop web pool check
186 web_app_pool:
187 name: '{{test_iis_webapppool_name}}'
188 state: stopped
189 register: stop_pool_check
190 check_mode: yes
191
192 - name: get actual status of pool check
193 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
194 register: stop_pool_actual_check
195
196 - name: assert stop web pool check
197 assert:
198 that:
199 - stop_pool_check is changed
200 - stop_pool_actual_check.stdout == 'Started\r\n'
201
202 - name: stop web pool
203 web_app_pool:
204 name: '{{test_iis_webapppool_name}}'
205 state: stopped
206 register: stop_pool
207
208 - name: get actual status of pool
209 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
210 register: stop_pool_actual
211
212 - name: assert stop web pool
213 assert:
214 that:
215 - stop_pool is changed
216 - stop_pool_actual.stdout == 'Stopped\r\n'
217
218 - name: stop web pool again
219 web_app_pool:
220 name: '{{test_iis_webapppool_name}}'
221 state: stopped
222 register: stop_pool_again
223
224 - name: get actual status of pool again
225 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
226 register: stop_pool_actual_again
227
228 - name: assert stop web pool again
229 assert:
230 that:
231 - stop_pool_again is not changed
232 - stop_pool_actual_again.stdout == 'Stopped\r\n'
233
234 - name: start web pool check
235 web_app_pool:
236 name: '{{test_iis_webapppool_name}}'
237 state: started
238 register: start_pool_check
239 check_mode: yes
240
241 - name: get actual status of pool check
242 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
243 register: start_pool_actual_check
244
245 - name: assert start web pool check
246 assert:
247 that:
248 - start_pool_check is changed
249 - start_pool_actual_check.stdout == 'Stopped\r\n'
250
251 - name: start web pool
252 web_app_pool:
253 name: '{{test_iis_webapppool_name}}'
254 state: started
255 register: start_pool
256
257 - name: get actual status of pool
258 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
259 register: start_pool_actual
260
261 - name: assert start web pool
262 assert:
263 that:
264 - start_pool is changed
265 - start_pool_actual.stdout == 'Started\r\n'
266
267 - name: start web pool again
268 web_app_pool:
269 name: '{{test_iis_webapppool_name}}'
270 state: started
271 register: start_pool_again
272
273 - name: get actual status of pool again
274 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
275 register: start_pool_actual_again
276
277 - name: assert start web pool again
278 assert:
279 that:
280 - start_pool_again is not changed
281 - start_pool_actual_again.stdout == 'Started\r\n'
282
283 - name: restart web pool
284 web_app_pool:
285 name: '{{test_iis_webapppool_name}}'
286 state: restarted
287 register: restart_pool
288
289 - name: get actual status of pool
290 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
291 register: restart_pool_actual
292
293 - name: assert restart web pool
294 assert:
295 that:
296 - restart_pool is changed
297 - restart_pool_actual.stdout == 'Started\r\n'
298
299 - name: stop pool before restart on stop test
300 web_app_pool:
301 name: '{{test_iis_webapppool_name}}'
302 state: stopped
303
304 - name: restart from stopped web pool check
305 web_app_pool:
306 name: '{{test_iis_webapppool_name}}'
307 state: restarted
308 register: restart_from_stop_pool_check
309 check_mode: yes
310
311 - name: get actual status of pool check
312 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
313 register: restart_from_stop_pool_actual_check
314
315 - name: assert restart from stopped web pool check
316 assert:
317 that:
318 - restart_from_stop_pool_check is changed
319 - restart_from_stop_pool_actual_check.stdout == 'Stopped\r\n'
320
321 - name: restart from stopped web pool
322 web_app_pool:
323 name: '{{test_iis_webapppool_name}}'
324 state: restarted
325 register: restart_from_stop_pool
326
327 - name: get actual status of pool
328 ansible.windows.win_command: powershell.exe "Import-Module WebAdministration; (Get-Item -Path IIS:\AppPools\{{test_iis_webapppool_name}}).state"
329 register: restart_from_stop_pool_actual
330
331 - name: assert restart from stopped web pool
332 assert:
333 that:
334 - restart_from_stop_pool is changed
335 - restart_from_stop_pool_actual.stdout == 'Started\r\n'
336
337 - name: set web pool attribute that is a collection (check mode)
338 web_app_pool:
339 name: '{{test_iis_webapppool_name}}'
340 state: present
341 attributes:
342 recycling.periodicRestart.schedule: "00:10:00,10:10:00"
343 register: collection_change_check
344 check_mode: yes
345
346 - name: get result of set web pool attribute that is a collection (check mode)
347 ansible.windows.win_shell: |
348 Import-Module WebAdministration
349 (Get-ItemProperty -Path "IIS:\AppPools\{{test_iis_webapppool_name}}" -Name recycling.periodicRestart.schedule).Collection | ForEach-Object { $_.value.ToString() }
350 register: collection_change_result_check
351
352 - name: assert results of set web pool attribute that is a collection (check mode)
353 assert:
354 that:
355 - collection_change_check is changed
356 - collection_change_result_check.stdout == ""
357
358 - name: set web pool attribute that is a collection
359 web_app_pool:
360 name: '{{test_iis_webapppool_name}}'
361 state: present
362 attributes:
363 recycling.periodicRestart.schedule: "00:10:00,10:10:00"
364 register: collection_change
365
366 - name: get result of set web pool attribute that is a collection
367 ansible.windows.win_shell: |
368 Import-Module WebAdministration
369 (Get-ItemProperty -Path "IIS:\AppPools\{{test_iis_webapppool_name}}" -Name recycling.periodicRestart.schedule).Collection | ForEach-Object { $_.value.ToString() }
370 register: collection_change_result
371
372 - name: assert results of set web pool attribute that is a collection
373 assert:
374 that:
375 - collection_change is changed
376 - collection_change_result.stdout_lines == [ "00:10:00", "10:10:00" ]
377
378 - name: set web pool attribute that is a collection (idempotent)
379 web_app_pool:
380 name: '{{test_iis_webapppool_name}}'
381 state: present
382 attributes:
383 recycling.periodicRestart.schedule: [ "00:10:00", "10:10:00" ]
384 register: collection_change_again
385
386 - name: assert results of set web pool attribute that is a collection (idempotent)
387 assert:
388 that:
389 - collection_change_again is not changed
390
391 - name: delete test pool
392 web_app_pool:
393 name: '{{test_iis_webapppool_name}}'
394 state: absent
395
396 - name: create test pool
397 web_app_pool:
398 name: '{{test_iis_webapppool_name}}'
399 state: present
400 register: iis_attributes_blank
401
402 - name: change attributes for newer IIS version check
403 web_app_pool:
404 name: '{{test_iis_webapppool_name}}'
405 state: present
406 attributes:
407 startMode: AlwaysRunning
408 processModel.identityType: SpecificUser
409 processModel.userName: '{{ansible_user}}'
410 processModel.password: '{{ ansible_password | default(ansible_test_connection_password) }}'
411 register: iis_attributes_new_check
412 check_mode: yes
413
414 - name: assert change attributes for newer IIS version check
415 assert:
416 that:
417 - iis_attributes_new_check is changed
418
419 - name: change attributes for newer IIS version
420 web_app_pool:
421 name: '{{test_iis_webapppool_name}}'
422 state: present
423 attributes:
424 startMode: AlwaysRunning
425 processModel.identityType: SpecificUser
426 processModel.userName: '{{ansible_user}}'
427 processModel.password: '{{ ansible_password | default(ansible_test_connection_password) }}'
428 register: iis_attributes_new
429
430 - name: assert change attributes for newer IIS version
431 assert:
432 that:
433 - iis_attributes_new is changed
434
435 - name: change attributes for newer IIS version again
436 web_app_pool:
437 name: '{{test_iis_webapppool_name}}'
438 state: present
439 attributes:
440 startMode: AlwaysRunning
441 processModel.identityType: 3
442 processModel.userName: '{{ansible_user}}'
443 processModel.password: '{{ ansible_password | default(ansible_test_connection_password) }}'
444 register: iis_attributes_new_again
445
446 - name: assert change attributes for newer IIS version again
447 assert:
448 that:
449 - iis_attributes_new_again is not changed