Debian Codegraph @

ansible_collections/community/zabbix/tests/integration/targets/test_zabbix_service/tasks/main.yml

raw
1 ---
2 - name: test - service
3 module_defaults:
4 community.zabbix.zabbix_service:
5 description: "Example Service for Service Module"
6 sortorder: 0
7 propagation_rule: increase
8 propagation_value: warning
9 state: present
10
11 block:
12 - name: "test - Create a new service with check_mode"
13 community.zabbix.zabbix_service:
14 name: ExampleServiceForServiceModule
15 check_mode: true
16 register: create_service_check_mode_result
17
18 - ansible.builtin.assert:
19 that:
20 - create_service_check_mode_result.changed is sameas true
21
22 - name: "test - Create a new service"
23 community.zabbix.zabbix_service:
24 name: ExampleServiceForServiceModule
25 register: create_service_result
26
27 - ansible.builtin.assert:
28 that:
29 - create_service_result.changed is sameas true
30
31 - name: "test - Create a new service (idempotency check)"
32 community.zabbix.zabbix_service:
33 name: ExampleServiceForServiceModule
34 register: create_service_idempotency_check_result
35
36 - ansible.builtin.assert:
37 that:
38 - create_service_idempotency_check_result.changed is sameas false
39
40 - name: "test - Update service add service tags"
41 community.zabbix.zabbix_service:
42 name: ExampleServiceForServiceModule
43 tags:
44 - tag: TagName1
45 value: TagValue1
46 register: update_service_stags_result
47
48 - ansible.builtin.assert:
49 that:
50 - update_service_stags_result.changed is sameas true
51
52 - name: "test - Update service with service tags (idempotency check)"
53 community.zabbix.zabbix_service:
54 name: ExampleServiceForServiceModule
55 tags:
56 - tag: TagName1
57 value: TagValue1
58 register: update_service_stags_idempotency_check_result
59
60 - ansible.builtin.assert:
61 that:
62 - update_service_stags_idempotency_check_result.changed is sameas false
63
64 - name: "test - Update service add more service tags"
65 community.zabbix.zabbix_service:
66 name: ExampleServiceForServiceModule
67 tags:
68 - tag: TagName1
69 value: TagValue1
70 - tag: TagName2
71 value: TagValue2
72 register: update_service_more_stags_result
73
74 - ansible.builtin.assert:
75 that:
76 - update_service_more_stags_result.changed is sameas true
77
78 - name: "test - Update service add more service tags (idempotency check)"
79 community.zabbix.zabbix_service:
80 name: ExampleServiceForServiceModule
81 tags:
82 - tag: TagName1
83 value: TagValue1
84 - tag: TagName2
85 value: TagValue2
86 register: update_service_more_stags_idempotency_check_result
87
88 - ansible.builtin.assert:
89 that:
90 - update_service_more_stags_idempotency_check_result.changed is sameas false
91
92 - name: "test - Update service remove service tags"
93 community.zabbix.zabbix_service:
94 name: ExampleServiceForServiceModule
95 tags:
96 - tag: TagName2
97 value: TagValue2
98 register: update_service_less_stags_result
99
100 - ansible.builtin.assert:
101 that:
102 - update_service_less_stags_result.changed is sameas true
103
104 - name: "test - Update service remove service tags (idempotency check)"
105 community.zabbix.zabbix_service:
106 name: ExampleServiceForServiceModule
107 tags:
108 - tag: TagName2
109 value: TagValue2
110 register: update_service_less_stags_idempotency_check_result
111
112 - ansible.builtin.assert:
113 that:
114 - update_service_less_stags_idempotency_check_result.changed is sameas false
115
116 - name: "test - Delete service"
117 community.zabbix.zabbix_service:
118 name: ExampleServiceForServiceModule
119 state: absent
120
121 - name: "test - Create service with one problem tag"
122 community.zabbix.zabbix_service:
123 name: ExampleServiceForServiceModule
124 problem_tags:
125 - tag: TagName1
126 operator: equals
127 value: TagValue1
128 register: create_service_with_ptag_result
129
130 - ansible.builtin.assert:
131 that:
132 - create_service_with_ptag_result.changed is sameas true
133
134 - name: "test - Create service with one problem tag (idempotency check)"
135 community.zabbix.zabbix_service:
136 name: ExampleServiceForServiceModule
137 problem_tags:
138 - tag: TagName1
139 operator: equals
140 value: TagValue1
141 register: create_service_with_ptag_idempotency_check_result
142
143 - name: "test - Update service with problem tag without operator"
144 community.zabbix.zabbix_service:
145 name: ExampleServiceForServiceModule
146 problem_tags:
147 - tag: TagName1
148 operator: equals
149 value: TagValue1
150 - tag: TagName2
151 value: TagValue2
152 register: update_service_with_ptag_woop_result
153
154 - ansible.builtin.assert:
155 that:
156 - update_service_with_ptag_woop_result.changed is sameas true
157
158 - name: "test - Update service with problem tag without operator (idempotency check)"
159 community.zabbix.zabbix_service:
160 name: ExampleServiceForServiceModule
161 problem_tags:
162 - tag: TagName1
163 operator: equals
164 value: TagValue1
165 - tag: TagName2
166 value: TagValue2
167 register: update_service_with_ptag_woop_idempotency_check_result
168
169 - ansible.builtin.assert:
170 that:
171 - update_service_with_ptag_woop_idempotency_check_result.changed is sameas false
172
173 - name: "test - Update service with problem tag with like operator"
174 community.zabbix.zabbix_service:
175 name: ExampleServiceForServiceModule
176 problem_tags:
177 - tag: TagName1
178 operator: equals
179 value: TagValue1
180 - tag: TagName2
181 value: TagValue2
182 - tag: TagName3
183 operator: like
184 value: TagValue3
185 register: update_service_with_ptag_wlikeop_result
186
187 - ansible.builtin.assert:
188 that:
189 - update_service_with_ptag_wlikeop_result.changed is sameas true
190
191 - name: "test - Update service with problem tag with like operator (idempotency check)"
192 community.zabbix.zabbix_service:
193 name: ExampleServiceForServiceModule
194 problem_tags:
195 - tag: TagName1
196 operator: equals
197 value: TagValue1
198 - tag: TagName2
199 value: TagValue2
200 - tag: TagName3
201 operator: like
202 value: TagValue3
203 register: update_service_with_ptag_wlikeop_idempotency_check_result
204
205 - ansible.builtin.assert:
206 that:
207 - update_service_with_ptag_wlikeop_idempotency_check_result.changed is sameas false
208
209 - name: "test - Update service with problem tag without operator and without value"
210 community.zabbix.zabbix_service:
211 name: ExampleServiceForServiceModule
212 problem_tags:
213 - tag: TagName1
214 operator: equals
215 value: TagValue1
216 - tag: TagName2
217 value: TagValue2
218 - tag: TagName3
219 operator: like
220 value: TagValue3
221 - tag: TagName4
222 register: update_service_with_ptag_woov_result
223
224 - ansible.builtin.assert:
225 that:
226 - update_service_with_ptag_woov_result.changed is sameas true
227
228 - name: "test - Update service with problem tag without operator and without value (idempotency check)"
229 community.zabbix.zabbix_service:
230 name: ExampleServiceForServiceModule
231 problem_tags:
232 - tag: TagName1
233 operator: equals
234 value: TagValue1
235 - tag: TagName2
236 value: TagValue2
237 - tag: TagName3
238 operator: like
239 value: TagValue3
240 - tag: TagName4
241 register: update_service_with_ptag_woov_idempotency_check_result
242
243 - ansible.builtin.assert:
244 that:
245 - update_service_with_ptag_woov_idempotency_check_result.changed is sameas false
246
247 - name: "test - Update service remove problem tags"
248 community.zabbix.zabbix_service:
249 name: ExampleServiceForServiceModule
250 problem_tags:
251 - tag: TagName1
252 operator: equals
253 value: TagValue1
254 - tag: TagName3
255 operator: like
256 value: TagValue3
257 register: update_service_remove_tags_result
258
259 - ansible.builtin.assert:
260 that:
261 - update_service_remove_tags_result.changed is sameas true
262
263 - name: "test - Update service remove problem tags (idempotency check)"
264 community.zabbix.zabbix_service:
265 name: ExampleServiceForServiceModule
266 problem_tags:
267 - tag: TagName1
268 operator: equals
269 value: TagValue1
270 - tag: TagName3
271 operator: like
272 value: TagValue3
273 register: update_service_remove_tags_idempotency_check_result
274
275 - ansible.builtin.assert:
276 that:
277 - update_service_remove_tags_idempotency_check_result.changed is sameas false
278
279 - name: "test - Update service remove all problem tags"
280 community.zabbix.zabbix_service:
281 name: ExampleServiceForServiceModule
282 register: update_service_remove_all_tags_result
283
284 - ansible.builtin.assert:
285 that:
286 - update_service_remove_all_tags_result.changed is sameas true
287
288 - name: "test - Update service remove all problem tags (idempotency check)"
289 community.zabbix.zabbix_service:
290 name: ExampleServiceForServiceModule
291 register: update_service_remove_all_tags_idempotency_check_result
292
293 - ansible.builtin.assert:
294 that:
295 - update_service_remove_all_tags_idempotency_check_result.changed is sameas false
296
297 - name: "test - Create a new child service"
298 community.zabbix.zabbix_service:
299 name: ExampleChildServiceForServiceModule
300 sortorder: 10
301 parents:
302 - ExampleServiceForServiceModule
303 register: create_child_service_result
304
305 - ansible.builtin.assert:
306 that:
307 - create_child_service_result.changed is sameas true
308
309 - name: "test - Create a new child service (idempotency check)"
310 community.zabbix.zabbix_service:
311 name: ExampleChildServiceForServiceModule
312 sortorder: 10
313 parents:
314 - ExampleServiceForServiceModule
315 register: create_child_service_idempotency_check_result
316
317 - ansible.builtin.assert:
318 that:
319 - create_child_service_idempotency_check_result.changed is sameas false
320
321 - name: "test - Update child service to remove parent"
322 community.zabbix.zabbix_service:
323 name: ExampleChildServiceForServiceModule
324 parents: []
325 register: update_child_service_delete_parent_result
326
327 - ansible.builtin.assert:
328 that:
329 - update_child_service_delete_parent_result.changed is sameas true
330
331 - name: "test - Create a new parent service"
332 community.zabbix.zabbix_service:
333 name: ExampleParentServiceForServiceModule
334
335 - name: "test - Delete child service"
336 community.zabbix.zabbix_service:
337 name: ExampleChildServiceForServiceModule
338 state: absent
339
340 - name: "test - Create a new child service with two parents"
341 community.zabbix.zabbix_service:
342 name: ExampleChildServiceForServiceModule
343 parents:
344 - ExampleServiceForServiceModule
345 - ExampleParentServiceForServiceModule
346 register: create_child_service_two_parents_result
347
348 - ansible.builtin.assert:
349 that:
350 - create_child_service_two_parents_result.changed is sameas true
351
352 - name: "test - Create a new child service with two parents (idempotency check)"
353 community.zabbix.zabbix_service:
354 name: ExampleChildServiceForServiceModule
355 parents:
356 - ExampleServiceForServiceModule
357 - ExampleParentServiceForServiceModule
358 register: create_child_service_two_parents_idempotency_check_result
359
360 - ansible.builtin.assert:
361 that:
362 - create_child_service_two_parents_idempotency_check_result.changed is sameas false
363
364 - name: "test - Remove one parent from new child service"
365 community.zabbix.zabbix_service:
366 name: ExampleChildServiceForServiceModule
367 parents:
368 - ExampleParentServiceForServiceModule
369 register: update_child_service_remove_parent_result
370
371 - ansible.builtin.assert:
372 that:
373 - update_child_service_remove_parent_result.changed is sameas true
374
375 - name: "test - Remove one parent from new child service (idempotency check)"
376 community.zabbix.zabbix_service:
377 name: ExampleChildServiceForServiceModule
378 parents:
379 - ExampleParentServiceForServiceModule
380 register: update_child_service_remove_parent_idempotency_check_result
381
382 - ansible.builtin.assert:
383 that:
384 - update_child_service_remove_parent_idempotency_check_result.changed is sameas false
385
386 - name: "test - Delete parent service 2"
387 community.zabbix.zabbix_service:
388 name: ExampleParentServiceForServiceModule
389 state: absent
390
391 - name: "test - Create parent service with child service"
392 community.zabbix.zabbix_service:
393 name: ExampleParentServiceForServiceModule
394 children:
395 - ExampleChildServiceForServiceModule
396 register: create_parent_service_with_child_result
397
398 - ansible.builtin.assert:
399 that:
400 - create_parent_service_with_child_result.changed is sameas true
401
402 - name: "test - Create parent service with child service (idempotency check)"
403 community.zabbix.zabbix_service:
404 name: ExampleParentServiceForServiceModule
405 children:
406 - ExampleChildServiceForServiceModule
407 register: create_parent_service_with_child_result_idempotency_check_result
408
409 - ansible.builtin.assert:
410 that:
411 - create_parent_service_with_child_result_idempotency_check_result.changed is sameas false
412
413 - name: "test - Create second chile service"
414 community.zabbix.zabbix_service:
415 name: ExampleChildServiceForServiceModule2
416
417 - name: "test - Update parent service with the second child service"
418 community.zabbix.zabbix_service:
419 name: ExampleParentServiceForServiceModule
420 children:
421 - ExampleChildServiceForServiceModule
422 - ExampleChildServiceForServiceModule2
423 register: update_parent_service_with_second_child_result
424
425 - ansible.builtin.assert:
426 that:
427 - update_parent_service_with_second_child_result.changed is sameas true
428
429 - name: "test - Update parent service with the second child service (idempotency check)"
430 community.zabbix.zabbix_service:
431 name: ExampleParentServiceForServiceModule
432 children:
433 - ExampleChildServiceForServiceModule
434 - ExampleChildServiceForServiceModule2
435 register: update_parent_service_with_second_child_result_idempotency_check_result
436
437 - ansible.builtin.assert:
438 that:
439 - update_parent_service_with_second_child_result_idempotency_check_result.changed is sameas false
440
441 - name: "test - Delete parent service"
442 community.zabbix.zabbix_service:
443 name: ExampleParentServiceForServiceModule
444 state: absent
445
446 - name: "test - Create parent service with two child services"
447 community.zabbix.zabbix_service:
448 name: ExampleParentServiceForServiceModule
449 children:
450 - ExampleChildServiceForServiceModule
451 - ExampleChildServiceForServiceModule2
452 register: create_parent_service_with_two_children_result
453
454 - ansible.builtin.assert:
455 that:
456 - create_parent_service_with_two_children_result.changed is sameas true
457
458 - name: "test - Create parent service with child services (idempotency check)"
459 community.zabbix.zabbix_service:
460 name: ExampleParentServiceForServiceModule
461 children:
462 - ExampleChildServiceForServiceModule
463 - ExampleChildServiceForServiceModule2
464 register: create_parent_service_with_two_children_idempotency_check_result
465
466 - ansible.builtin.assert:
467 that:
468 - create_parent_service_with_two_children_idempotency_check_result.changed is sameas false
469
470 - name: "test - Delete parent service"
471 community.zabbix.zabbix_service:
472 name: ExampleParentServiceForServiceModule
473 state: absent
474
475 - name: "test - Delete child service"
476 community.zabbix.zabbix_service:
477 name: ExampleChildServiceForServiceModule
478 state: absent
479 - name: "test - Delete child servicei 2"
480 community.zabbix.zabbix_service:
481 name: ExampleChildServiceForServiceModule2
482 state: absent
483
484 - name: "test - Delete new service"
485 community.zabbix.zabbix_service:
486 name: ExampleServiceForServiceModule
487 state: absent
488 register: delete_service_result
489
490 - ansible.builtin.assert:
491 that:
492 - delete_service_result.changed is sameas true
493
494 - name: "test - Delete new service (idempotency check)"
495 community.zabbix.zabbix_service:
496 name: ExampleServiceForServiceModule
497 state: absent
498 register: delete_service_idempotency_check_result
499
500 - ansible.builtin.assert:
501 that:
502 - delete_service_idempotency_check_result.changed is sameas false
503
504 - name: "test - Create a new service with status rule"
505 community.zabbix.zabbix_service:
506 name: ExampleServiceForServiceModule
507 status_rules:
508 - type: at_least_n_child_services_have_status_or_above
509 limit_value: 4242
510 limit_status: ok
511 new_status: not_classified
512 register: create_service_sr_result
513
514 - ansible.builtin.assert:
515 that:
516 - create_service_sr_result.changed is sameas true
517
518 - name: "test - Create a new service with status rule (idempotency check)"
519 community.zabbix.zabbix_service:
520 name: ExampleServiceForServiceModule
521 status_rules:
522 - type: at_least_n_child_services_have_status_or_above
523 limit_value: 4242
524 limit_status: ok
525 new_status: not_classified
526 register: create_service_sr_idempotency_check_result
527
528 - ansible.builtin.assert:
529 that:
530 - create_service_sr_idempotency_check_result.changed is sameas false
531
532 - name: "test - Update service with the second status rule"
533 community.zabbix.zabbix_service:
534 name: ExampleServiceForServiceModule
535 status_rules:
536 - type: at_least_n_child_services_have_status_or_above
537 limit_value: 4242
538 limit_status: ok
539 new_status: not_classified
540 - type: at_least_npct_child_services_have_status_or_above
541 limit_value: 42
542 limit_status: information
543 new_status: warning
544 register: update_service_add_sr_result
545
546 - ansible.builtin.assert:
547 that:
548 - update_service_add_sr_result.changed is sameas true
549
550 - name: "test - Update service with the second status rule (idempotency check)"
551 community.zabbix.zabbix_service:
552 name: ExampleServiceForServiceModule
553 status_rules:
554 - type: at_least_n_child_services_have_status_or_above
555 limit_value: 4242
556 limit_status: ok
557 new_status: not_classified
558 - type: at_least_npct_child_services_have_status_or_above
559 limit_value: 42
560 limit_status: information
561 new_status: warning
562 register: update_service_add_sr_idempotency_check_result
563
564 - ansible.builtin.assert:
565 that:
566 - update_service_add_sr_idempotency_check_result.changed is sameas false
567
568 - name: "test - Update service remove status rule"
569 community.zabbix.zabbix_service:
570 name: ExampleServiceForServiceModule
571 status_rules:
572 - type: at_least_npct_child_services_have_status_or_above
573 limit_value: 42
574 limit_status: information
575 new_status: warning
576 register: update_service_remove_sr_result
577
578 - ansible.builtin.assert:
579 that:
580 - update_service_remove_sr_result.changed is sameas true
581
582 - name: "test - Update service remove status rule (idempotency check)"
583 community.zabbix.zabbix_service:
584 name: ExampleServiceForServiceModule
585 status_rules:
586 - type: at_least_npct_child_services_have_status_or_above
587 limit_value: 42
588 limit_status: information
589 new_status: warning
590 register: update_service_remove_sr_idempotency_check_result
591
592 - ansible.builtin.assert:
593 that:
594 - update_service_remove_sr_idempotency_check_result.changed is sameas false
595
596 - name: "test - Delete new service"
597 community.zabbix.zabbix_service:
598 name: ExampleServiceForServiceModule
599 state: absent
600 register: delete_service_result