| 1 |
--- |
| 2 |
- name: test - Test action operation script |
| 3 |
module_defaults: |
| 4 |
community.zabbix.zabbix_script: |
| 5 |
name: Test action operation script |
| 6 |
scope: action_operation |
| 7 |
script_type: webhook |
| 8 |
command: "return 0" |
| 9 |
description: "Test action operation script" |
| 10 |
state: present |
| 11 |
|
| 12 |
block: |
| 13 |
- name: test - Create new action operation script to execute webhook check mode |
| 14 |
community.zabbix.zabbix_script: |
| 15 |
check_mode: true |
| 16 |
register: create_action_check_mode_result |
| 17 |
|
| 18 |
- assert: |
| 19 |
that: |
| 20 |
- create_action_check_mode_result.changed is sameas true |
| 21 |
|
| 22 |
- name: test - Create new action operation script to execute webhook |
| 23 |
community.zabbix.zabbix_script: |
| 24 |
register: create_action_result |
| 25 |
|
| 26 |
- assert: |
| 27 |
that: |
| 28 |
- create_action_result.changed is sameas true |
| 29 |
|
| 30 |
- name: test - Create new action operation script to execute webhook again |
| 31 |
community.zabbix.zabbix_script: |
| 32 |
register: create_action_again_result |
| 33 |
|
| 34 |
- assert: |
| 35 |
that: |
| 36 |
- create_action_again_result.changed is sameas false |
| 37 |
|
| 38 |
- name: test - Update action operation script to execute webhook with host group |
| 39 |
community.zabbix.zabbix_script: |
| 40 |
host_group: "Discovered hosts" |
| 41 |
register: update_action_host_group_result |
| 42 |
|
| 43 |
- assert: |
| 44 |
that: |
| 45 |
- update_action_host_group_result.changed is sameas true |
| 46 |
|
| 47 |
- name: test - Update action operation script to execute webhook with host group again |
| 48 |
community.zabbix.zabbix_script: |
| 49 |
host_group: "Discovered hosts" |
| 50 |
register: update_action_host_group_again_result |
| 51 |
|
| 52 |
- assert: |
| 53 |
that: |
| 54 |
- update_action_host_group_again_result.changed is sameas false |
| 55 |
|
| 56 |
- name: test - Update action operation script to execute webhook with parameters |
| 57 |
community.zabbix.zabbix_script: |
| 58 |
host_group: "Discovered hosts" |
| 59 |
parameters: |
| 60 |
- name: param_name1 |
| 61 |
register: update_action_param_result |
| 62 |
|
| 63 |
- assert: |
| 64 |
that: |
| 65 |
- update_action_param_result.changed is sameas true |
| 66 |
|
| 67 |
- name: test - Update action operation script to execute webhook with parameters again |
| 68 |
community.zabbix.zabbix_script: |
| 69 |
host_group: "Discovered hosts" |
| 70 |
parameters: |
| 71 |
- name: param_name1 |
| 72 |
register: update_action_param_again_result |
| 73 |
|
| 74 |
- assert: |
| 75 |
that: |
| 76 |
- update_action_param_again_result.changed is sameas false |
| 77 |
|
| 78 |
- name: test - Update action operation script to execute webhook with parameters and value |
| 79 |
community.zabbix.zabbix_script: |
| 80 |
host_group: "Discovered hosts" |
| 81 |
parameters: |
| 82 |
- name: param_name1 |
| 83 |
- name: param_name2 |
| 84 |
value: value2 |
| 85 |
register: update_action_param_value_result |
| 86 |
|
| 87 |
- assert: |
| 88 |
that: |
| 89 |
- update_action_param_value_result.changed is sameas true |
| 90 |
|
| 91 |
- name: test - Update action operation script to execute webhook with parameters and value again |
| 92 |
community.zabbix.zabbix_script: |
| 93 |
host_group: "Discovered hosts" |
| 94 |
parameters: |
| 95 |
- name: param_name1 |
| 96 |
- name: param_name2 |
| 97 |
value: value2 |
| 98 |
register: update_action_param_value_again_result |
| 99 |
|
| 100 |
- assert: |
| 101 |
that: |
| 102 |
- update_action_param_value_again_result.changed is sameas false |
| 103 |
|
| 104 |
- name: test - Update action operation script remove host group |
| 105 |
community.zabbix.zabbix_script: |
| 106 |
parameters: |
| 107 |
- name: param_name1 |
| 108 |
- name: param_name2 |
| 109 |
value: value2 |
| 110 |
register: update_action_no_host_group_result |
| 111 |
|
| 112 |
- assert: |
| 113 |
that: |
| 114 |
- update_action_no_host_group_result.changed is sameas true |
| 115 |
|
| 116 |
- name: test - Update action operation script remove host group again |
| 117 |
community.zabbix.zabbix_script: |
| 118 |
parameters: |
| 119 |
- name: param_name1 |
| 120 |
- name: param_name2 |
| 121 |
value: value2 |
| 122 |
register: update_action_no_host_group_again_result |
| 123 |
|
| 124 |
- assert: |
| 125 |
that: |
| 126 |
- update_action_no_host_group_again_result.changed is sameas false |
| 127 |
|
| 128 |
- name: test - Update action operation script to type Script |
| 129 |
community.zabbix.zabbix_script: |
| 130 |
script_type: script |
| 131 |
execute_on: zabbix_agent |
| 132 |
command: echo 1 |
| 133 |
register: update_action_script_result |
| 134 |
|
| 135 |
- assert: |
| 136 |
that: |
| 137 |
- update_action_script_result.changed is sameas true |
| 138 |
|
| 139 |
- name: test - Update action operation script to type Script again |
| 140 |
community.zabbix.zabbix_script: |
| 141 |
script_type: script |
| 142 |
execute_on: zabbix_agent |
| 143 |
command: echo 1 |
| 144 |
register: update_action_script_again_result |
| 145 |
|
| 146 |
- assert: |
| 147 |
that: |
| 148 |
- update_action_script_again_result.changed is sameas false |
| 149 |
|
| 150 |
- name: test - Update action operation script to execute on server |
| 151 |
community.zabbix.zabbix_script: |
| 152 |
script_type: script |
| 153 |
execute_on: zabbix_server |
| 154 |
command: echo 1 |
| 155 |
register: update_action_script_server_result |
| 156 |
|
| 157 |
- assert: |
| 158 |
that: |
| 159 |
- update_action_script_server_result.changed is sameas true |
| 160 |
|
| 161 |
- name: test - Update action operation script to execute on server again |
| 162 |
community.zabbix.zabbix_script: |
| 163 |
script_type: script |
| 164 |
execute_on: zabbix_server |
| 165 |
command: echo 1 |
| 166 |
register: update_action_script_server_again_result |
| 167 |
|
| 168 |
- assert: |
| 169 |
that: |
| 170 |
- update_action_script_server_again_result.changed is sameas false |
| 171 |
|
| 172 |
- name: test - Update action operation script to execute on server or proxy |
| 173 |
community.zabbix.zabbix_script: |
| 174 |
script_type: script |
| 175 |
execute_on: zabbix_server_proxy |
| 176 |
command: echo 1 |
| 177 |
register: update_action_script_server_proxy_result |
| 178 |
|
| 179 |
- assert: |
| 180 |
that: |
| 181 |
- update_action_script_server_proxy_result.changed is sameas true |
| 182 |
|
| 183 |
- name: test - Update action operation script to execute on server or proxy again |
| 184 |
community.zabbix.zabbix_script: |
| 185 |
script_type: script |
| 186 |
execute_on: zabbix_server_proxy |
| 187 |
command: echo 1 |
| 188 |
register: update_action_script_server_proxy_again_result |
| 189 |
|
| 190 |
- assert: |
| 191 |
that: |
| 192 |
- update_action_script_server_proxy_again_result.changed is sameas false |
| 193 |
|
| 194 |
- name: test - Update action operation script to type SSH |
| 195 |
community.zabbix.zabbix_script: |
| 196 |
script_type: ssh |
| 197 |
authtype: password |
| 198 |
username: bla |
| 199 |
password: blabla |
| 200 |
command: echo 2 |
| 201 |
register: update_action_script_ssh_result |
| 202 |
|
| 203 |
- assert: |
| 204 |
that: |
| 205 |
- update_action_script_ssh_result.changed is sameas true |
| 206 |
|
| 207 |
- name: test - Update action operation script to type SSH again |
| 208 |
community.zabbix.zabbix_script: |
| 209 |
script_type: ssh |
| 210 |
authtype: password |
| 211 |
username: bla |
| 212 |
password: blabla |
| 213 |
command: echo 2 |
| 214 |
register: update_action_script_ssh_again_result |
| 215 |
|
| 216 |
- assert: |
| 217 |
that: |
| 218 |
- update_action_script_ssh_again_result.changed is sameas false |
| 219 |
|
| 220 |
- name: test - Update action operation script type SSH key auth |
| 221 |
community.zabbix.zabbix_script: |
| 222 |
script_type: ssh |
| 223 |
authtype: public_key |
| 224 |
username: bla |
| 225 |
publickey: blabla |
| 226 |
privatekey: blablabla |
| 227 |
command: echo 3 |
| 228 |
register: update_action_script_ssh_authkey_result |
| 229 |
|
| 230 |
- assert: |
| 231 |
that: |
| 232 |
- update_action_script_ssh_authkey_result.changed is sameas true |
| 233 |
|
| 234 |
- name: test - Update action operation script type SSH key auth again |
| 235 |
community.zabbix.zabbix_script: |
| 236 |
script_type: ssh |
| 237 |
authtype: public_key |
| 238 |
username: bla |
| 239 |
publickey: blabla |
| 240 |
privatekey: blablabla |
| 241 |
command: echo 3 |
| 242 |
register: update_action_script_ssh_authkey_again_result |
| 243 |
|
| 244 |
- assert: |
| 245 |
that: |
| 246 |
- update_action_script_ssh_authkey_again_result.changed is sameas false |
| 247 |
|
| 248 |
- name: test - Update action operation script type SSH add port |
| 249 |
community.zabbix.zabbix_script: |
| 250 |
script_type: ssh |
| 251 |
authtype: public_key |
| 252 |
username: bla |
| 253 |
publickey: blabla |
| 254 |
privatekey: blablabla |
| 255 |
command: echo 3 |
| 256 |
port: 222 |
| 257 |
register: update_action_script_ssh_port_result |
| 258 |
|
| 259 |
- assert: |
| 260 |
that: |
| 261 |
- update_action_script_ssh_port_result.changed is sameas true |
| 262 |
|
| 263 |
- name: test - Update action operation script type SSH add port again |
| 264 |
community.zabbix.zabbix_script: |
| 265 |
script_type: ssh |
| 266 |
authtype: public_key |
| 267 |
username: bla |
| 268 |
publickey: blabla |
| 269 |
privatekey: blablabla |
| 270 |
command: echo 3 |
| 271 |
port: 222 |
| 272 |
register: update_action_script_ssh_port_again_result |
| 273 |
|
| 274 |
- assert: |
| 275 |
that: |
| 276 |
- update_action_script_ssh_port_again_result.changed is sameas false |
| 277 |
|
| 278 |
- name: test - Update action operation script to type Telnet |
| 279 |
community.zabbix.zabbix_script: |
| 280 |
script_type: telnet |
| 281 |
username: bla1 |
| 282 |
password: blabla1 |
| 283 |
command: echo 4 |
| 284 |
port: 223 |
| 285 |
register: update_action_script_telnet_result |
| 286 |
|
| 287 |
- assert: |
| 288 |
that: |
| 289 |
- update_action_script_telnet_result.changed is sameas true |
| 290 |
|
| 291 |
- name: test - Update action operation script to type Telnet again |
| 292 |
community.zabbix.zabbix_script: |
| 293 |
script_type: telnet |
| 294 |
username: bla1 |
| 295 |
password: blabla1 |
| 296 |
command: echo 4 |
| 297 |
port: 223 |
| 298 |
register: update_action_script_telnet_again_result |
| 299 |
|
| 300 |
- assert: |
| 301 |
that: |
| 302 |
- update_action_script_telnet_again_result.changed is sameas false |
| 303 |
|
| 304 |
- name: test - Update action operation script to type IPMI |
| 305 |
community.zabbix.zabbix_script: |
| 306 |
script_type: ipmi |
| 307 |
command: echo 5 |
| 308 |
register: update_action_script_ipmi_result |
| 309 |
|
| 310 |
- assert: |
| 311 |
that: |
| 312 |
- update_action_script_ipmi_result.changed is sameas true |
| 313 |
|
| 314 |
- name: test - Update action operation script to type IPMI again |
| 315 |
community.zabbix.zabbix_script: |
| 316 |
script_type: ipmi |
| 317 |
command: echo 5 |
| 318 |
register: update_action_script_ipmi_again_result |
| 319 |
|
| 320 |
- assert: |
| 321 |
that: |
| 322 |
- update_action_script_ipmi_again_result.changed is sameas false |
| 323 |
|
| 324 |
- name: test - Delete action operation script |
| 325 |
community.zabbix.zabbix_script: |
| 326 |
state: absent |
| 327 |
register: delete_action_result |
| 328 |
|
| 329 |
- assert: |
| 330 |
that: |
| 331 |
- delete_action_result.changed is sameas true |
| 332 |
|
| 333 |
- name: test - Delete action operation script again |
| 334 |
community.zabbix.zabbix_script: |
| 335 |
state: absent |
| 336 |
register: delete_action_again_result |
| 337 |
|
| 338 |
- assert: |
| 339 |
that: |
| 340 |
- delete_action_again_result.changed is sameas false |
| 341 |
|
| 342 |
- name: test - Test manual host action script |
| 343 |
module_defaults: |
| 344 |
community.zabbix.zabbix_script: |
| 345 |
name: Test manual host action script |
| 346 |
scope: manual_host_action |
| 347 |
script_type: webhook |
| 348 |
command: "return 0" |
| 349 |
description: "Test manual host action script" |
| 350 |
state: present |
| 351 |
|
| 352 |
block: |
| 353 |
- name: test - Create new manual host action script to execute webhook check mode |
| 354 |
community.zabbix.zabbix_script: |
| 355 |
parameters: |
| 356 |
- name: param_name1 |
| 357 |
- name: param_name2 |
| 358 |
value: value2 |
| 359 |
check_mode: true |
| 360 |
register: create_action_check_mode_result |
| 361 |
|
| 362 |
- assert: |
| 363 |
that: |
| 364 |
- create_action_check_mode_result.changed is sameas true |
| 365 |
|
| 366 |
- name: test - Create new manual host action script to execute webhook |
| 367 |
community.zabbix.zabbix_script: |
| 368 |
parameters: |
| 369 |
- name: param_name1 |
| 370 |
- name: param_name2 |
| 371 |
value: value2 |
| 372 |
register: create_action_result |
| 373 |
|
| 374 |
- assert: |
| 375 |
that: |
| 376 |
- create_action_result.changed is sameas true |
| 377 |
|
| 378 |
- name: test - Create new manual host action script to execute webhook again |
| 379 |
community.zabbix.zabbix_script: |
| 380 |
parameters: |
| 381 |
- name: param_name1 |
| 382 |
- name: param_name2 |
| 383 |
value: value2 |
| 384 |
register: create_action_again_result |
| 385 |
|
| 386 |
- assert: |
| 387 |
that: |
| 388 |
- create_action_again_result.changed is sameas false |
| 389 |
|
| 390 |
- name: test - Update manual host action script with menu path |
| 391 |
community.zabbix.zabbix_script: |
| 392 |
menu_path: menu/submenu |
| 393 |
register: update_action_result |
| 394 |
|
| 395 |
- assert: |
| 396 |
that: |
| 397 |
- update_action_result.changed is sameas true |
| 398 |
|
| 399 |
- name: test - Update manual host action script with menu path again |
| 400 |
community.zabbix.zabbix_script: |
| 401 |
menu_path: menu/submenu |
| 402 |
register: update_action_again_result |
| 403 |
|
| 404 |
- assert: |
| 405 |
that: |
| 406 |
- update_action_again_result.changed is sameas false |
| 407 |
|
| 408 |
- name: test - Update manual host action script with user group |
| 409 |
community.zabbix.zabbix_script: |
| 410 |
menu_path: menu/submenu |
| 411 |
user_group: Guests |
| 412 |
register: update_action_usrgrp_result |
| 413 |
|
| 414 |
- assert: |
| 415 |
that: |
| 416 |
- update_action_usrgrp_result.changed is sameas true |
| 417 |
|
| 418 |
- name: test - Update manual host action script with user group again |
| 419 |
community.zabbix.zabbix_script: |
| 420 |
menu_path: menu/submenu |
| 421 |
user_group: Guests |
| 422 |
register: update_action_usrgrp_again_result |
| 423 |
|
| 424 |
- assert: |
| 425 |
that: |
| 426 |
- update_action_usrgrp_again_result.changed is sameas false |
| 427 |
|
| 428 |
- name: test - Update manual host action script with Write permissions |
| 429 |
community.zabbix.zabbix_script: |
| 430 |
host_access: write |
| 431 |
register: update_action_host_perms_result |
| 432 |
|
| 433 |
- assert: |
| 434 |
that: |
| 435 |
- update_action_host_perms_result.changed is sameas true |
| 436 |
|
| 437 |
- name: test - Update manual host action script with Write permissions again |
| 438 |
community.zabbix.zabbix_script: |
| 439 |
host_access: write |
| 440 |
register: update_action_host_perms_again_result |
| 441 |
|
| 442 |
- assert: |
| 443 |
that: |
| 444 |
- update_action_host_perms_again_result.changed is sameas false |
| 445 |
|
| 446 |
- name: test - Update manual host action script with confirmation |
| 447 |
community.zabbix.zabbix_script: |
| 448 |
confirmation: "Are you sure?" |
| 449 |
register: update_action_host_confirm_result |
| 450 |
|
| 451 |
- assert: |
| 452 |
that: |
| 453 |
- update_action_host_confirm_result.changed is sameas true |
| 454 |
|
| 455 |
- name: test - Update manual host action script with confirmation again |
| 456 |
community.zabbix.zabbix_script: |
| 457 |
confirmation: "Are you sure?" |
| 458 |
register: update_action_host_confirm_again_result |
| 459 |
|
| 460 |
- assert: |
| 461 |
that: |
| 462 |
- update_action_host_confirm_again_result.changed is sameas false |
| 463 |
|
| 464 |
- name: test - Delete manual host action script |
| 465 |
community.zabbix.zabbix_script: |
| 466 |
state: absent |
| 467 |
|
| 468 |
- name: test - Test url script type |
| 469 |
module_defaults: |
| 470 |
community.zabbix.zabbix_script: |
| 471 |
name: Test manual event action script |
| 472 |
scope: manual_event_action |
| 473 |
description: "Test manual event action script" |
| 474 |
state: present |
| 475 |
|
| 476 |
when: zabbix_version is version('7.0', '>=') |
| 477 |
block: |
| 478 |
- name: test - Create new url script |
| 479 |
community.zabbix.zabbix_script: |
| 480 |
url: "http://google.com" |
| 481 |
new_window: true |
| 482 |
script_type: url |
| 483 |
register: create_script_url |
| 484 |
|
| 485 |
- assert: |
| 486 |
that: |
| 487 |
- create_script_url.changed is sameas true |
| 488 |
|
| 489 |
- name: test - Create new url script - again |
| 490 |
community.zabbix.zabbix_script: |
| 491 |
url: "http://google.com" |
| 492 |
new_window: true |
| 493 |
script_type: url |
| 494 |
register: create_script_url_again |
| 495 |
|
| 496 |
- assert: |
| 497 |
that: |
| 498 |
- create_script_url_again.changed is sameas false |
| 499 |
|
| 500 |
- name: test - Create new url script - update url |
| 501 |
community.zabbix.zabbix_script: |
| 502 |
url: "http://facebook.com" |
| 503 |
new_window: true |
| 504 |
script_type: url |
| 505 |
register: create_script_url_update_url |
| 506 |
|
| 507 |
- assert: |
| 508 |
that: |
| 509 |
- create_script_url_update_url.changed is sameas true |
| 510 |
|
| 511 |
- name: test - Create new url script - update new_window |
| 512 |
community.zabbix.zabbix_script: |
| 513 |
url: "http://facebook.com" |
| 514 |
new_window: false |
| 515 |
script_type: url |
| 516 |
register: create_script_url_update_new_window |
| 517 |
|
| 518 |
- assert: |
| 519 |
that: |
| 520 |
- create_script_url_update_new_window.changed is sameas true |
| 521 |
|
| 522 |
- name: test - Enable User Input |
| 523 |
community.zabbix.zabbix_script: |
| 524 |
url: "http://facebook.com" |
| 525 |
new_window: false |
| 526 |
script_type: url |
| 527 |
user_input_enabled: true |
| 528 |
user_input_prompt: "Test user prompt" |
| 529 |
user_input_type: "regex" |
| 530 |
user_input_default_input: "test" |
| 531 |
user_input_regex: "test.*" |
| 532 |
register: create_script_url_add_user_input |
| 533 |
|
| 534 |
- assert: |
| 535 |
that: |
| 536 |
- create_script_url_update_new_window.changed is sameas true |
| 537 |
|
| 538 |
- name: test - Enable User Input - Again (No Change) |
| 539 |
community.zabbix.zabbix_script: |
| 540 |
url: "http://facebook.com" |
| 541 |
new_window: false |
| 542 |
script_type: url |
| 543 |
user_input_enabled: true |
| 544 |
user_input_prompt: "Test user prompt" |
| 545 |
user_input_type: "regex" |
| 546 |
user_input_default_input: "test" |
| 547 |
user_input_regex: "test.*" |
| 548 |
register: create_script_url_add_user_input_again |
| 549 |
|
| 550 |
- assert: |
| 551 |
that: |
| 552 |
- create_script_url_add_user_input_again.changed is sameas false |
| 553 |
|
| 554 |
- name: test - Enable User Input - Update Input Prompt |
| 555 |
community.zabbix.zabbix_script: |
| 556 |
url: "http://facebook.com" |
| 557 |
new_window: false |
| 558 |
script_type: url |
| 559 |
user_input_enabled: true |
| 560 |
user_input_prompt: "Test user prompt update" |
| 561 |
user_input_type: "regex" |
| 562 |
user_input_default_input: "test" |
| 563 |
user_input_regex: "test.*" |
| 564 |
register: create_script_user_input_update_prompt |
| 565 |
|
| 566 |
- assert: |
| 567 |
that: |
| 568 |
- create_script_user_input_update_prompt.changed is sameas true |
| 569 |
|
| 570 |
- name: test - Enable User Input - Update default input |
| 571 |
community.zabbix.zabbix_script: |
| 572 |
url: "http://facebook.com" |
| 573 |
new_window: false |
| 574 |
script_type: url |
| 575 |
user_input_enabled: true |
| 576 |
user_input_prompt: "Test user prompt update" |
| 577 |
user_input_type: "regex" |
| 578 |
user_input_default_input: "test2" |
| 579 |
user_input_regex: "test.*" |
| 580 |
register: create_script_user_input_update_default_input |
| 581 |
|
| 582 |
- assert: |
| 583 |
that: |
| 584 |
- create_script_user_input_update_default_input.changed is sameas true |
| 585 |
|
| 586 |
- name: test - Enable User Input - Update regex |
| 587 |
community.zabbix.zabbix_script: |
| 588 |
url: "http://facebook.com" |
| 589 |
new_window: false |
| 590 |
script_type: url |
| 591 |
user_input_enabled: true |
| 592 |
user_input_prompt: "Test user prompt update" |
| 593 |
user_input_type: "regex" |
| 594 |
user_input_default_input: "test2" |
| 595 |
user_input_regex: "tes.*" |
| 596 |
register: create_script_user_input_update_regex |
| 597 |
|
| 598 |
- assert: |
| 599 |
that: |
| 600 |
- create_script_user_input_update_regex.changed is sameas true |
| 601 |
|
| 602 |
- name: test - Enable User Input - Change to List |
| 603 |
community.zabbix.zabbix_script: |
| 604 |
url: "http://facebook.com" |
| 605 |
new_window: false |
| 606 |
script_type: url |
| 607 |
user_input_enabled: true |
| 608 |
user_input_prompt: "Test user prompt update" |
| 609 |
user_input_type: "dropdown" |
| 610 |
user_input_list: |
| 611 |
- test 1 |
| 612 |
- test 2 |
| 613 |
- test 3 |
| 614 |
register: create_script_user_input_change_to_list |
| 615 |
|
| 616 |
- assert: |
| 617 |
that: |
| 618 |
- create_script_user_input_change_to_list.changed is sameas true |
| 619 |
|
| 620 |
- name: test - Enable User Input - Change to List - Again (No Change) |
| 621 |
community.zabbix.zabbix_script: |
| 622 |
url: "http://facebook.com" |
| 623 |
new_window: false |
| 624 |
script_type: url |
| 625 |
user_input_enabled: true |
| 626 |
user_input_prompt: "Test user prompt update" |
| 627 |
user_input_type: "dropdown" |
| 628 |
user_input_list: |
| 629 |
- test 1 |
| 630 |
- test 2 |
| 631 |
- test 3 |
| 632 |
register: create_script_user_input_change_to_list_again |
| 633 |
|
| 634 |
- assert: |
| 635 |
that: |
| 636 |
- create_script_user_input_change_to_list_again.changed is sameas false |
| 637 |
|
| 638 |
- name: test - Enable User Input - Update List |
| 639 |
community.zabbix.zabbix_script: |
| 640 |
url: "http://facebook.com" |
| 641 |
new_window: false |
| 642 |
script_type: url |
| 643 |
user_input_enabled: true |
| 644 |
user_input_prompt: "Test user prompt update" |
| 645 |
user_input_type: "dropdown" |
| 646 |
user_input_list: |
| 647 |
- test 1 |
| 648 |
- test 2 |
| 649 |
- test 4 |
| 650 |
register: create_script_user_input_update_list |
| 651 |
|
| 652 |
- assert: |
| 653 |
that: |
| 654 |
- create_script_user_input_update_list.changed is sameas true |
| 655 |
|
| 656 |
- name: test - Delete url host action script |
| 657 |
community.zabbix.zabbix_script: |
| 658 |
state: absent |
| 659 |
|
| 660 |
- name: test - Create new url script for early versions of Zabbix (should fail) |
| 661 |
community.zabbix.zabbix_script: |
| 662 |
url: "http://google.com" |
| 663 |
new_window: true |
| 664 |
register: create_script_url_fail |
| 665 |
when: zabbix_version is version('7.0', '<') |
| 666 |
ignore_errors: true |
| 667 |
|
| 668 |
- ansible.builtin.assert: |
| 669 |
that: create_script_url_fail.failed is sameas True |
| 670 |
when: zabbix_version is version('7.0', '<') |
| 671 |
|
| 672 |
|
| 673 |
- name: test - Test manual event action script |
| 674 |
module_defaults: |
| 675 |
community.zabbix.zabbix_script: |
| 676 |
name: Test manual event action script |
| 677 |
scope: manual_event_action |
| 678 |
script_type: webhook |
| 679 |
command: "return 0" |
| 680 |
description: "Test manual event action script" |
| 681 |
state: present |
| 682 |
|
| 683 |
block: |
| 684 |
- name: test - Create new manual event action script to execute webhook check mode |
| 685 |
community.zabbix.zabbix_script: |
| 686 |
parameters: |
| 687 |
- name: param_name1 |
| 688 |
- name: param_name2 |
| 689 |
value: value2 |
| 690 |
check_mode: true |
| 691 |
register: create_action_check_mode_result |
| 692 |
|
| 693 |
- assert: |
| 694 |
that: |
| 695 |
- create_action_check_mode_result.changed is sameas true |
| 696 |
|
| 697 |
- name: test - Create new manual event action script to execute webhook |
| 698 |
community.zabbix.zabbix_script: |
| 699 |
parameters: |
| 700 |
- name: param_name1 |
| 701 |
- name: param_name2 |
| 702 |
value: value2 |
| 703 |
register: create_action_result |
| 704 |
|
| 705 |
- assert: |
| 706 |
that: |
| 707 |
- create_action_result.changed is sameas true |
| 708 |
|
| 709 |
- name: test - Create new manual event action script to execute webhook again |
| 710 |
community.zabbix.zabbix_script: |
| 711 |
parameters: |
| 712 |
- name: param_name1 |
| 713 |
- name: param_name2 |
| 714 |
value: value2 |
| 715 |
diff: true |
| 716 |
register: create_action_again_result |
| 717 |
|
| 718 |
- assert: |
| 719 |
that: |
| 720 |
- create_action_again_result.changed is sameas false |
| 721 |
|
| 722 |
- name: test - Delete manual host action script |
| 723 |
community.zabbix.zabbix_script: |
| 724 |
state: absent |