| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
- name: Test that we have an ACI MultiSite host, username and password |
| 7 |
ansible.builtin.fail: |
| 8 |
msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' |
| 9 |
when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
- name: Set vars |
| 14 |
ansible.builtin.set_fact: |
| 15 |
mso_info: &mso_info |
| 16 |
host: '{{ mso_hostname }}' |
| 17 |
username: '{{ mso_username }}' |
| 18 |
password: '{{ mso_password }}' |
| 19 |
validate_certs: '{{ mso_validate_certs | default(false) }}' |
| 20 |
use_ssl: '{{ mso_use_ssl | default(true) }}' |
| 21 |
use_proxy: '{{ mso_use_proxy | default(true) }}' |
| 22 |
output_level: '{{ mso_output_level | default("debug") }}' |
| 23 |
|
| 24 |
- name: Query MSO version |
| 25 |
cisco.mso.mso_version: |
| 26 |
<<: *mso_info |
| 27 |
username: r_ansible_github_ci |
| 28 |
password: '{{ apic_password }}' |
| 29 |
login_domain: test |
| 30 |
state: query |
| 31 |
register: version |
| 32 |
|
| 33 |
- name: Ensure sites exists |
| 34 |
cisco.mso.mso_site: |
| 35 |
<<: *mso_info |
| 36 |
site: '{{ item.site }}' |
| 37 |
apic_username: '{{ item.username }}' |
| 38 |
apic_password: '{{ item.password }}' |
| 39 |
apic_site_id: '{{ item.id }}' |
| 40 |
urls: |
| 41 |
- https://{{ item.urls }} |
| 42 |
state: present |
| 43 |
loop: |
| 44 |
- { site: '{{ mso_site | default("ansible_test") }}', username: '{{ apic_username }}', password: '{{ apic_password }}', id: '{{ apic_site_id | default(101) }}', urls: '{{ apic_hostname }}' } |
| 45 |
|
| 46 |
- name: Remove schemas |
| 47 |
cisco.mso.mso_schema: |
| 48 |
<<: *mso_info |
| 49 |
schema: '{{ item }}' |
| 50 |
state: absent |
| 51 |
loop: |
| 52 |
- '{{ mso_schema | default("ansible_test") }}_2' |
| 53 |
- '{{ mso_schema | default("ansible_test") }}' |
| 54 |
|
| 55 |
- name: Remove tenants |
| 56 |
cisco.mso.mso_tenant: &tenant_absent |
| 57 |
<<: *mso_info |
| 58 |
tenant: '{{ item }}' |
| 59 |
state: absent |
| 60 |
loop: |
| 61 |
- ansible_test1 |
| 62 |
- ansible_test2 |
| 63 |
- ansible_test3 |
| 64 |
- tenant_with_site |
| 65 |
|
| 66 |
|
| 67 |
- name: Add tenant (check_mode) |
| 68 |
cisco.mso.mso_tenant: &tenant_present |
| 69 |
<<: *mso_info |
| 70 |
tenant: ansible_test1 |
| 71 |
display_name: Ansible test title |
| 72 |
description: Ansible test tenant |
| 73 |
state: present |
| 74 |
check_mode: true |
| 75 |
register: cm_add_tenant |
| 76 |
|
| 77 |
- name: Verify cm_add_tenant |
| 78 |
ansible.builtin.assert: |
| 79 |
that: |
| 80 |
- cm_add_tenant is changed |
| 81 |
- cm_add_tenant.previous == {} |
| 82 |
- cm_add_tenant.current.id is not defined |
| 83 |
- cm_add_tenant.current.name == 'ansible_test1' |
| 84 |
- cm_add_tenant.current.description == 'Ansible test tenant' |
| 85 |
- cm_add_tenant.current.userAssociations | length == 1 |
| 86 |
|
| 87 |
- name: Add tenant (normal mode) |
| 88 |
cisco.mso.mso_tenant: *tenant_present |
| 89 |
register: nm_add_tenant |
| 90 |
|
| 91 |
- name: Verify nm_add_tenant |
| 92 |
ansible.builtin.assert: |
| 93 |
that: |
| 94 |
- nm_add_tenant is changed |
| 95 |
- nm_add_tenant.previous == {} |
| 96 |
- nm_add_tenant.current.id is defined |
| 97 |
- nm_add_tenant.current.name == 'ansible_test1' |
| 98 |
- nm_add_tenant.current.description == 'Ansible test tenant' |
| 99 |
- nm_add_tenant.current.userAssociations | length == 1 |
| 100 |
|
| 101 |
- name: Add tenant again (check_mode) |
| 102 |
cisco.mso.mso_tenant: *tenant_present |
| 103 |
check_mode: true |
| 104 |
register: cm_add_tenant_again |
| 105 |
|
| 106 |
- name: Verify cm_add_tenant_again |
| 107 |
ansible.builtin.assert: |
| 108 |
that: |
| 109 |
- cm_add_tenant_again is not changed |
| 110 |
- cm_add_tenant_again.previous.name == 'ansible_test1' |
| 111 |
- cm_add_tenant_again.previous.description == 'Ansible test tenant' |
| 112 |
- cm_add_tenant_again.current.id == nm_add_tenant.current.id |
| 113 |
- cm_add_tenant_again.current.name == 'ansible_test1' |
| 114 |
- cm_add_tenant_again.current.description == 'Ansible test tenant' |
| 115 |
- cm_add_tenant_again.current.userAssociations == cm_add_tenant_again.previous.userAssociations |
| 116 |
|
| 117 |
- name: Add tenant again (normal mode) |
| 118 |
cisco.mso.mso_tenant: *tenant_present |
| 119 |
register: nm_add_tenant_again |
| 120 |
|
| 121 |
- name: Verify nm_add_tenant_again |
| 122 |
ansible.builtin.assert: |
| 123 |
that: |
| 124 |
- nm_add_tenant_again is not changed |
| 125 |
- nm_add_tenant_again.previous.name == 'ansible_test1' |
| 126 |
- nm_add_tenant_again.previous.description == 'Ansible test tenant' |
| 127 |
- nm_add_tenant_again.current.id == nm_add_tenant.current.id |
| 128 |
- nm_add_tenant_again.current.name == 'ansible_test1' |
| 129 |
- nm_add_tenant_again.current.description == 'Ansible test tenant' |
| 130 |
- nm_add_tenant_again.current.userAssociations == nm_add_tenant_again.previous.userAssociations |
| 131 |
|
| 132 |
|
| 133 |
- name: Add tenant 2 (normal mode) |
| 134 |
cisco.mso.mso_tenant: |
| 135 |
<<: *tenant_present |
| 136 |
tenant: ansible_test2 |
| 137 |
users: |
| 138 |
- '{{ mso_username }}' |
| 139 |
display_name: null |
| 140 |
state: present |
| 141 |
register: nm_add_tenant2 |
| 142 |
|
| 143 |
- name: Verify nm_add_tenant2 |
| 144 |
ansible.builtin.assert: |
| 145 |
that: |
| 146 |
- nm_add_tenant2 is changed |
| 147 |
|
| 148 |
- name: Verify nm_add_tenant2 (when mso_username != admin) |
| 149 |
ansible.builtin.assert: |
| 150 |
that: |
| 151 |
- nm_add_tenant2.current.userAssociations | length == 2 |
| 152 |
when: mso_username != 'admin' |
| 153 |
|
| 154 |
- name: Verify nm_add_tenant2 (when mso_username == admin) |
| 155 |
ansible.builtin.assert: |
| 156 |
that: |
| 157 |
- nm_add_tenant2.current.userAssociations | length == 1 |
| 158 |
when: mso_username == 'admin' |
| 159 |
|
| 160 |
- name: Add tenant 2 again (normal mode) |
| 161 |
cisco.mso.mso_tenant: |
| 162 |
<<: *tenant_present |
| 163 |
tenant: ansible_test2 |
| 164 |
users: |
| 165 |
- '{{ mso_username }}' |
| 166 |
display_name: null |
| 167 |
state: present |
| 168 |
register: nm_add_tenant2_again |
| 169 |
|
| 170 |
- name: Verify nm_add_tenant2_again |
| 171 |
ansible.builtin.assert: |
| 172 |
that: |
| 173 |
- nm_add_tenant2_again is not changed |
| 174 |
|
| 175 |
- name: Verify nm_add_tenant2_again (when mso_username != admin) |
| 176 |
ansible.builtin.assert: |
| 177 |
that: |
| 178 |
- nm_add_tenant2_again.current.userAssociations | length == 2 |
| 179 |
when: mso_username != 'admin' |
| 180 |
|
| 181 |
- name: Verify nm_add_tenant2_again (when mso_username == admin) |
| 182 |
ansible.builtin.assert: |
| 183 |
that: |
| 184 |
- nm_add_tenant2_again.current.userAssociations | length == 1 |
| 185 |
when: mso_username == 'admin' |
| 186 |
|
| 187 |
|
| 188 |
- name: Add tenant 3 (check_mode) |
| 189 |
cisco.mso.mso_tenant: |
| 190 |
<<: *tenant_present |
| 191 |
tenant: ansible_test3 |
| 192 |
display_name: null |
| 193 |
remote_users: |
| 194 |
- name: r_ansible_github_ci |
| 195 |
login_domain: test |
| 196 |
state: present |
| 197 |
check_mode: true |
| 198 |
register: cm_add_rmt_usr_tenant3 |
| 199 |
|
| 200 |
- name: Verify cm_add_rmt_usr_tenant3 |
| 201 |
ansible.builtin.assert: |
| 202 |
that: |
| 203 |
- cm_add_rmt_usr_tenant3 is changed |
| 204 |
|
| 205 |
- name: Add tenant 3 (normal_mode) |
| 206 |
cisco.mso.mso_tenant: |
| 207 |
<<: *tenant_present |
| 208 |
tenant: ansible_test3 |
| 209 |
display_name: null |
| 210 |
remote_users: |
| 211 |
- name: r_ansible_github_ci |
| 212 |
login_domain: test |
| 213 |
state: present |
| 214 |
register: nm_add_rmt_usr_tenant3 |
| 215 |
|
| 216 |
- name: Verify cm_add_rmt_usr_tenant3 |
| 217 |
ansible.builtin.assert: |
| 218 |
that: |
| 219 |
- nm_add_rmt_usr_tenant3 is changed |
| 220 |
- nm_add_rmt_usr_tenant3.current.name == 'ansible_test3' |
| 221 |
|
| 222 |
- name: Add tenant 3 with duplicate admin user (normal mode) |
| 223 |
cisco.mso.mso_tenant: |
| 224 |
<<: *tenant_present |
| 225 |
tenant: ansible_test3 |
| 226 |
users: |
| 227 |
- admin |
| 228 |
- admin |
| 229 |
display_name: null |
| 230 |
state: present |
| 231 |
ignore_errors: true |
| 232 |
register: nm_add_tenant3_with_duplicate_admin |
| 233 |
|
| 234 |
- name: Verify nm_add_tenant3_with_duplicate_admin |
| 235 |
ansible.builtin.assert: |
| 236 |
that: |
| 237 |
- nm_add_tenant3_with_duplicate_admin is not changed |
| 238 |
- nm_add_tenant3_with_duplicate_admin.msg == "User 'admin' is duplicate." |
| 239 |
|
| 240 |
- name: Add tenant 3 with invalid user (normal mode) |
| 241 |
cisco.mso.mso_tenant: |
| 242 |
<<: *tenant_present |
| 243 |
tenant: ansible_test3 |
| 244 |
users: |
| 245 |
- invalid user |
| 246 |
display_name: null |
| 247 |
state: present |
| 248 |
ignore_errors: true |
| 249 |
register: nm_add_tenant3_with_invalid_user |
| 250 |
|
| 251 |
- name: nm_add_tenant3_with_invalid_user |
| 252 |
ansible.builtin.assert: |
| 253 |
that: |
| 254 |
- nm_add_tenant3_with_invalid_user is not changed |
| 255 |
- nm_add_tenant3_with_invalid_user.msg == "User 'invalid user' is not a valid user name." |
| 256 |
|
| 257 |
- name: Add tenant 3 (normal mode) |
| 258 |
cisco.mso.mso_tenant: |
| 259 |
<<: *tenant_present |
| 260 |
tenant: ansible_test3 |
| 261 |
users: |
| 262 |
- '{{ mso_username }}' |
| 263 |
remote_users: |
| 264 |
- name: r_ansible_github_ci |
| 265 |
login_domain: test |
| 266 |
display_name: null |
| 267 |
state: present |
| 268 |
register: nm_add_tenant3 |
| 269 |
|
| 270 |
- name: Verify nm_add_tenant3 |
| 271 |
ansible.builtin.assert: |
| 272 |
that: |
| 273 |
- nm_add_tenant3 is changed |
| 274 |
|
| 275 |
- name: Verify nm_add_tenant3 (when mso_username != admin) |
| 276 |
ansible.builtin.assert: |
| 277 |
that: |
| 278 |
- nm_add_tenant3.current.userAssociations | length == 3 |
| 279 |
when: mso_username != 'admin' |
| 280 |
|
| 281 |
- name: Verify nm_add_tenant3 (when mso_username == admin) |
| 282 |
ansible.builtin.assert: |
| 283 |
that: |
| 284 |
- nm_add_tenant3.current.userAssociations | length == 1 |
| 285 |
when: mso_username == 'admin' |
| 286 |
|
| 287 |
|
| 288 |
- name: Change tenant (check_mode) |
| 289 |
cisco.mso.mso_tenant: |
| 290 |
<<: *tenant_present |
| 291 |
tenant: ansible_test1 |
| 292 |
description: Ansible test tenant 2 |
| 293 |
check_mode: true |
| 294 |
register: cm_change_tenant |
| 295 |
|
| 296 |
- name: Verify cm_change_tenant |
| 297 |
ansible.builtin.assert: |
| 298 |
that: |
| 299 |
- cm_change_tenant is changed |
| 300 |
- cm_change_tenant.current.id == nm_add_tenant.current.id |
| 301 |
- cm_change_tenant.current.name == 'ansible_test1' |
| 302 |
- cm_change_tenant.current.description == 'Ansible test tenant 2' |
| 303 |
|
| 304 |
- name: Change tenant (normal mode) |
| 305 |
cisco.mso.mso_tenant: |
| 306 |
<<: *tenant_present |
| 307 |
tenant: ansible_test1 |
| 308 |
description: Ansible test tenant 2 |
| 309 |
output_level: debug |
| 310 |
register: nm_change_tenant |
| 311 |
|
| 312 |
- name: Verify nm_change_tenant |
| 313 |
ansible.builtin.assert: |
| 314 |
that: |
| 315 |
- nm_change_tenant is changed |
| 316 |
- nm_change_tenant.current.id == nm_add_tenant.current.id |
| 317 |
- nm_change_tenant.current.name == 'ansible_test1' |
| 318 |
- nm_change_tenant.current.description == 'Ansible test tenant 2' |
| 319 |
|
| 320 |
- name: Change tenant again (check_mode) |
| 321 |
cisco.mso.mso_tenant: |
| 322 |
<<: *tenant_present |
| 323 |
tenant: ansible_test1 |
| 324 |
description: Ansible test tenant 2 |
| 325 |
check_mode: true |
| 326 |
register: cm_change_tenant_again |
| 327 |
|
| 328 |
- name: Verify cm_change_tenant_again |
| 329 |
ansible.builtin.assert: |
| 330 |
that: |
| 331 |
- cm_change_tenant_again is not changed |
| 332 |
- cm_change_tenant_again.current.id == nm_add_tenant.current.id |
| 333 |
- cm_change_tenant_again.current.name == 'ansible_test1' |
| 334 |
- cm_change_tenant_again.current.description == 'Ansible test tenant 2' |
| 335 |
|
| 336 |
- name: Change tenant again (normal mode) |
| 337 |
cisco.mso.mso_tenant: |
| 338 |
<<: *tenant_present |
| 339 |
tenant: ansible_test1 |
| 340 |
description: Ansible test tenant 2 |
| 341 |
register: nm_change_tenant_again |
| 342 |
|
| 343 |
- name: Verify nm_change_tenant_again |
| 344 |
ansible.builtin.assert: |
| 345 |
that: |
| 346 |
- nm_change_tenant_again is not changed |
| 347 |
- nm_change_tenant_again.current.id == nm_add_tenant.current.id |
| 348 |
- nm_change_tenant_again.current.name == 'ansible_test1' |
| 349 |
- nm_change_tenant_again.current.description == 'Ansible test tenant 2' |
| 350 |
|
| 351 |
|
| 352 |
- name: Query all tenants (check_mode) |
| 353 |
cisco.mso.mso_tenant: &tenant_query |
| 354 |
<<: *mso_info |
| 355 |
state: query |
| 356 |
check_mode: true |
| 357 |
register: cm_query_all_tenants |
| 358 |
|
| 359 |
- name: Query all tenants (normal mode) |
| 360 |
cisco.mso.mso_tenant: *tenant_query |
| 361 |
register: nm_query_all_tenants |
| 362 |
|
| 363 |
- name: Verify query_all_tenants |
| 364 |
ansible.builtin.assert: |
| 365 |
that: |
| 366 |
- cm_query_all_tenants is not changed |
| 367 |
- nm_query_all_tenants is not changed |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
- name: Query our tenant |
| 373 |
cisco.mso.mso_tenant: |
| 374 |
<<: *tenant_query |
| 375 |
tenant: ansible_test1 |
| 376 |
check_mode: true |
| 377 |
register: cm_query_tenant |
| 378 |
|
| 379 |
- name: Query our tenant |
| 380 |
cisco.mso.mso_tenant: |
| 381 |
<<: *tenant_query |
| 382 |
tenant: ansible_test1 |
| 383 |
register: nm_query_tenant |
| 384 |
|
| 385 |
- name: Verify query_tenant |
| 386 |
ansible.builtin.assert: |
| 387 |
that: |
| 388 |
- cm_query_tenant is not changed |
| 389 |
- cm_query_tenant.current.id == nm_add_tenant.current.id |
| 390 |
- cm_query_tenant.current.name == 'ansible_test1' |
| 391 |
- cm_query_tenant.current.description == 'Ansible test tenant 2' |
| 392 |
- nm_query_tenant is not changed |
| 393 |
- nm_query_tenant.current.id == nm_add_tenant.current.id |
| 394 |
- nm_query_tenant.current.name == 'ansible_test1' |
| 395 |
- nm_query_tenant.current.description == 'Ansible test tenant 2' |
| 396 |
- cm_query_tenant.current == nm_query_tenant.current |
| 397 |
|
| 398 |
|
| 399 |
- name: Remove tenant (check_mode) |
| 400 |
cisco.mso.mso_tenant: |
| 401 |
<<: *tenant_absent |
| 402 |
tenant: ansible_test1 |
| 403 |
check_mode: true |
| 404 |
register: cm_remove_tenant |
| 405 |
|
| 406 |
- name: Verify cm_remove_tenant |
| 407 |
ansible.builtin.assert: |
| 408 |
that: |
| 409 |
- cm_remove_tenant is changed |
| 410 |
- cm_remove_tenant.current == {} |
| 411 |
|
| 412 |
- name: Remove tenant (normal mode) |
| 413 |
cisco.mso.mso_tenant: |
| 414 |
<<: *tenant_absent |
| 415 |
tenant: ansible_test1 |
| 416 |
register: nm_remove_tenant |
| 417 |
|
| 418 |
- name: Verify nm_remove_tenant |
| 419 |
ansible.builtin.assert: |
| 420 |
that: |
| 421 |
- nm_remove_tenant is changed |
| 422 |
- nm_remove_tenant.current == {} |
| 423 |
|
| 424 |
- name: Remove tenant again (check_mode) |
| 425 |
cisco.mso.mso_tenant: |
| 426 |
<<: *tenant_absent |
| 427 |
tenant: ansible_test1 |
| 428 |
check_mode: true |
| 429 |
register: cm_remove_tenant_again |
| 430 |
|
| 431 |
- name: Verify cm_remove_tenant_again |
| 432 |
ansible.builtin.assert: |
| 433 |
that: |
| 434 |
- cm_remove_tenant_again is not changed |
| 435 |
- cm_remove_tenant_again.current == {} |
| 436 |
|
| 437 |
- name: Remove tenant again (normal mode) |
| 438 |
cisco.mso.mso_tenant: |
| 439 |
<<: *tenant_absent |
| 440 |
tenant: ansible_test1 |
| 441 |
register: nm_remove_tenant_again |
| 442 |
|
| 443 |
- name: Verify nm_remove_tenant_again |
| 444 |
ansible.builtin.assert: |
| 445 |
that: |
| 446 |
- nm_remove_tenant_again is not changed |
| 447 |
- nm_remove_tenant_again.current == {} |
| 448 |
|
| 449 |
|
| 450 |
- name: Query non-existing tenant (check_mode) |
| 451 |
cisco.mso.mso_tenant: |
| 452 |
<<: *tenant_query |
| 453 |
tenant: ansible_test1 |
| 454 |
check_mode: true |
| 455 |
register: cm_query_non_tenant |
| 456 |
|
| 457 |
- name: Query non-existing tenant (normal mode) |
| 458 |
cisco.mso.mso_tenant: |
| 459 |
<<: *tenant_query |
| 460 |
tenant: ansible_test1 |
| 461 |
register: nm_query_non_tenant |
| 462 |
|
| 463 |
|
| 464 |
- name: Verify query_non_tenant |
| 465 |
ansible.builtin.assert: |
| 466 |
that: |
| 467 |
- cm_query_non_tenant is not changed |
| 468 |
- nm_query_non_tenant is not changed |
| 469 |
- cm_query_non_tenant.current == nm_query_non_tenant.current |
| 470 |
|
| 471 |
- name: Add common tenant |
| 472 |
cisco.mso.mso_tenant: |
| 473 |
<<: *tenant_present |
| 474 |
tenant: common |
| 475 |
display_name: common |
| 476 |
sites: ['{{ mso_site | default("ansible_test") }}'] |
| 477 |
register: nm_add_common_tenant |
| 478 |
|
| 479 |
- name: Verify nm_add_common_tenant |
| 480 |
ansible.builtin.assert: |
| 481 |
that: |
| 482 |
- nm_add_common_tenant is changed |
| 483 |
- nm_add_common_tenant.current.name == "common" |
| 484 |
|
| 485 |
- name: Add tenant with site |
| 486 |
cisco.mso.mso_tenant: |
| 487 |
<<: *tenant_present |
| 488 |
tenant: tenant_with_site |
| 489 |
display_name: tenant_with_site |
| 490 |
sites: '{{ mso_site | default("ansible_test") }}' |
| 491 |
register: nm_add_tenant_with_site |
| 492 |
|
| 493 |
- name: Verify nm_add_tenant_with_site |
| 494 |
ansible.builtin.assert: |
| 495 |
that: |
| 496 |
- nm_add_tenant_with_site is changed |
| 497 |
- nm_add_tenant_with_site.current.name == "tenant_with_site" |
| 498 |
|
| 499 |
- name: Remove common tenant |
| 500 |
cisco.mso.mso_tenant: |
| 501 |
<<: *tenant_absent |
| 502 |
tenant: common |
| 503 |
ignore_errors: true |
| 504 |
register: rm_common |
| 505 |
|
| 506 |
- name: Verify rm_common |
| 507 |
ansible.builtin.assert: |
| 508 |
that: |
| 509 |
- rm_common.msg is search("Common [Tt]enant cannot be deleted") |
| 510 |
|
| 511 |
- name: Remove tenant_with_site |
| 512 |
cisco.mso.mso_tenant: |
| 513 |
<<: *tenant_absent |
| 514 |
tenant: tenant_with_site |
| 515 |
register: rm_tenant_with_site |
| 516 |
|
| 517 |
- name: Verify rm_tenant_with_site |
| 518 |
ansible.builtin.assert: |
| 519 |
that: |
| 520 |
- rm_tenant_with_site is changed |
| 521 |
- rm_tenant_with_site.current == {} |
| 522 |
|
| 523 |
- name: Remove "anstest_imp_tenant" to the MSO if exists |
| 524 |
cisco.mso.mso_tenant: |
| 525 |
<<: *mso_info |
| 526 |
tenant: anstest_imp_tenant |
| 527 |
display_name: anstest_imp_tenant_display_name |
| 528 |
description: anstest_imp_tenant_description |
| 529 |
sites: '{{ mso_site | default("ansible_test") }}' |
| 530 |
state: absent |
| 531 |
register: pre_test_anstest_imp_tenant_absent |
| 532 |
|
| 533 |
- name: Import "anstest_imp_tenant" to the MSO with check mode |
| 534 |
cisco.mso.mso_tenant: &cm_import_anstest_imp_tenant_present |
| 535 |
<<: *mso_info |
| 536 |
tenant: anstest_imp_tenant |
| 537 |
display_name: anstest_imp_tenant_display_name |
| 538 |
description: anstest_imp_tenant_description |
| 539 |
sites: '{{ mso_site | default("ansible_test") }}' |
| 540 |
state: present |
| 541 |
check_mode: true |
| 542 |
register: cm_import_anstest_imp_tenant_present |
| 543 |
|
| 544 |
- name: Assertions check for import "anstest_imp_tenant" to the MSO with check mode |
| 545 |
ansible.builtin.assert: |
| 546 |
that: |
| 547 |
- cm_import_anstest_imp_tenant_present is changed |
| 548 |
- cm_import_anstest_imp_tenant_present.current != {} |
| 549 |
- cm_import_anstest_imp_tenant_present.previous == {} |
| 550 |
- cm_import_anstest_imp_tenant_present.current.name == "anstest_imp_tenant" |
| 551 |
- cm_import_anstest_imp_tenant_present.current.displayName == "anstest_imp_tenant_display_name" |
| 552 |
- cm_import_anstest_imp_tenant_present.current.description == "anstest_imp_tenant_description" |
| 553 |
|
| 554 |
- name: Import "anstest_imp_tenant" to the MSO with normal mode |
| 555 |
cisco.mso.mso_tenant: &nm_import_anstest_imp_tenant_present |
| 556 |
<<: *cm_import_anstest_imp_tenant_present |
| 557 |
register: nm_import_anstest_imp_tenant_present |
| 558 |
|
| 559 |
- name: Assertions check for import "anstest_imp_tenant" to the MSO with normal mode |
| 560 |
ansible.builtin.assert: |
| 561 |
that: |
| 562 |
- nm_import_anstest_imp_tenant_present is changed |
| 563 |
- nm_import_anstest_imp_tenant_present.current != {} |
| 564 |
- nm_import_anstest_imp_tenant_present.previous == {} |
| 565 |
- nm_import_anstest_imp_tenant_present.current.name == "anstest_imp_tenant" |
| 566 |
- nm_import_anstest_imp_tenant_present.current.displayName == "anstest_imp_tenant_display_name" |
| 567 |
- nm_import_anstest_imp_tenant_present.current.description == "anstest_imp_tenant_description" |
| 568 |
|
| 569 |
- name: Import "anstest_imp_tenant" to the MSO with normal mode - idempotency works |
| 570 |
cisco.mso.mso_tenant: |
| 571 |
<<: *nm_import_anstest_imp_tenant_present |
| 572 |
register: idempotency_nm_import_anstest_imp_tenant_present |
| 573 |
|
| 574 |
- name: Idempotency assertions check for import "anstest_imp_tenant" to the MSO with normal mode |
| 575 |
ansible.builtin.assert: |
| 576 |
that: |
| 577 |
- idempotency_nm_import_anstest_imp_tenant_present is not changed |
| 578 |
- idempotency_nm_import_anstest_imp_tenant_present.current != {} |
| 579 |
- idempotency_nm_import_anstest_imp_tenant_present.previous != {} |
| 580 |
- idempotency_nm_import_anstest_imp_tenant_present.current.name == "anstest_imp_tenant" |
| 581 |
- idempotency_nm_import_anstest_imp_tenant_present.current.displayName == "anstest_imp_tenant_display_name" |
| 582 |
- idempotency_nm_import_anstest_imp_tenant_present.current.description == "anstest_imp_tenant_description" |
| 583 |
- idempotency_nm_import_anstest_imp_tenant_present.previous.name == "anstest_imp_tenant" |
| 584 |
- idempotency_nm_import_anstest_imp_tenant_present.previous.displayName == "anstest_imp_tenant_display_name" |
| 585 |
- idempotency_nm_import_anstest_imp_tenant_present.previous.description == "anstest_imp_tenant_description" |
| 586 |
|
| 587 |
- name: Query a tenant with name "anstest_imp_tenant" when it is imported to the MSO |
| 588 |
cisco.mso.mso_tenant: |
| 589 |
<<: *mso_info |
| 590 |
tenant: anstest_imp_tenant |
| 591 |
state: query |
| 592 |
register: query_anstest_imp_tenant |
| 593 |
|
| 594 |
- name: Assertions check for query a tenant with name "anstest_imp_tenant" when it is imported to the MSO |
| 595 |
ansible.builtin.assert: |
| 596 |
that: |
| 597 |
- query_anstest_imp_tenant is not changed |
| 598 |
- query_anstest_imp_tenant.current != {} |
| 599 |
- query_anstest_imp_tenant.current.name == "anstest_imp_tenant" |
| 600 |
- query_anstest_imp_tenant.current.displayName == "anstest_imp_tenant_display_name" |
| 601 |
- query_anstest_imp_tenant.current.description == "anstest_imp_tenant_description" |
| 602 |
|
| 603 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with check mode |
| 604 |
cisco.mso.mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 605 |
<<: *mso_info |
| 606 |
tenant: anstest_imp_tenant |
| 607 |
orchestrator_only: yes |
| 608 |
state: absent |
| 609 |
check_mode: true |
| 610 |
register: cm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 611 |
|
| 612 |
- name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with check mode |
| 613 |
ansible.builtin.assert: |
| 614 |
that: |
| 615 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes is changed |
| 616 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} |
| 617 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes.previous != {} |
| 618 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.name == "anstest_imp_tenant" |
| 619 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.displayName == "anstest_imp_tenant_display_name" |
| 620 |
- cm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.description == "anstest_imp_tenant_description" |
| 621 |
|
| 622 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode |
| 623 |
cisco.mso.mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 624 |
<<: *cm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 625 |
register: nm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 626 |
|
| 627 |
- name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode |
| 628 |
ansible.builtin.assert: |
| 629 |
that: |
| 630 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes is changed |
| 631 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} |
| 632 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous != {} |
| 633 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.name == "anstest_imp_tenant" |
| 634 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.displayName == "anstest_imp_tenant_display_name" |
| 635 |
- nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.description == "anstest_imp_tenant_description" |
| 636 |
|
| 637 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode - idempotency works |
| 638 |
cisco.mso.mso_tenant: |
| 639 |
<<: *nm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 640 |
register: idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes |
| 641 |
|
| 642 |
- name: Idempotency assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode |
| 643 |
ansible.builtin.assert: |
| 644 |
that: |
| 645 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes is not changed |
| 646 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} |
| 647 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous == {} |
| 648 |
|
| 649 |
- name: Import "anstest_imp_tenant" to the MSO with normal mode once again |
| 650 |
cisco.mso.mso_tenant: |
| 651 |
<<: *nm_import_anstest_imp_tenant_present |
| 652 |
register: nm_import_tenant_once_again |
| 653 |
|
| 654 |
- name: Assertions check for import "anstest_imp_tenant" to the MSO with normal mode once again |
| 655 |
ansible.builtin.assert: |
| 656 |
that: |
| 657 |
- nm_import_tenant_once_again is changed |
| 658 |
- nm_import_tenant_once_again.current != {} |
| 659 |
- nm_import_tenant_once_again.previous == {} |
| 660 |
- nm_import_tenant_once_again.current.name == "anstest_imp_tenant" |
| 661 |
- nm_import_tenant_once_again.current.displayName == "anstest_imp_tenant_display_name" |
| 662 |
- nm_import_tenant_once_again.current.description == "anstest_imp_tenant_description" |
| 663 |
|
| 664 |
- name: Update "anstest_imp_tenant" tenant description with check mode |
| 665 |
cisco.mso.mso_tenant: &cm_update_anstest_imp_tenant |
| 666 |
<<: *nm_import_anstest_imp_tenant_present |
| 667 |
description: "updated_anstest_imp_tenant_description" |
| 668 |
check_mode: true |
| 669 |
register: cm_update_anstest_imp_tenant |
| 670 |
|
| 671 |
- name: Assertions check for update "anstest_imp_tenant" tenant description with check mode |
| 672 |
ansible.builtin.assert: |
| 673 |
that: |
| 674 |
- cm_update_anstest_imp_tenant is changed |
| 675 |
- cm_update_anstest_imp_tenant.current != {} |
| 676 |
- cm_update_anstest_imp_tenant.previous != {} |
| 677 |
- cm_update_anstest_imp_tenant.current.name == "anstest_imp_tenant" |
| 678 |
- cm_update_anstest_imp_tenant.current.displayName == "anstest_imp_tenant_display_name" |
| 679 |
- cm_update_anstest_imp_tenant.current.description == "updated_anstest_imp_tenant_description" |
| 680 |
- cm_update_anstest_imp_tenant.previous.name == "anstest_imp_tenant" |
| 681 |
- cm_update_anstest_imp_tenant.previous.displayName == "anstest_imp_tenant_display_name" |
| 682 |
- cm_update_anstest_imp_tenant.previous.description == "anstest_imp_tenant_description" |
| 683 |
|
| 684 |
- name: Update "anstest_imp_tenant" tenant description with normal mode |
| 685 |
cisco.mso.mso_tenant: &nm_update_anstest_imp_tenant |
| 686 |
<<: *cm_update_anstest_imp_tenant |
| 687 |
register: nm_update_anstest_imp_tenant |
| 688 |
|
| 689 |
- name: Assertions check for update "anstest_imp_tenant" tenant description with normal mode |
| 690 |
ansible.builtin.assert: |
| 691 |
that: |
| 692 |
- nm_update_anstest_imp_tenant is changed |
| 693 |
- nm_update_anstest_imp_tenant.current != {} |
| 694 |
- nm_update_anstest_imp_tenant.previous != {} |
| 695 |
- nm_update_anstest_imp_tenant.current.name == "anstest_imp_tenant" |
| 696 |
- nm_update_anstest_imp_tenant.current.displayName == "anstest_imp_tenant_display_name" |
| 697 |
- nm_update_anstest_imp_tenant.current.description == "updated_anstest_imp_tenant_description" |
| 698 |
- nm_update_anstest_imp_tenant.previous.name == "anstest_imp_tenant" |
| 699 |
- nm_update_anstest_imp_tenant.previous.displayName == "anstest_imp_tenant_display_name" |
| 700 |
- nm_update_anstest_imp_tenant.previous.description == "anstest_imp_tenant_description" |
| 701 |
|
| 702 |
- name: Update "anstest_imp_tenant" tenant description with normal mode - idempotency works |
| 703 |
cisco.mso.mso_tenant: |
| 704 |
<<: *nm_update_anstest_imp_tenant |
| 705 |
register: nm_idempotency_update_anstest_imp_tenant |
| 706 |
|
| 707 |
- name: Idempotency assertions check for update "anstest_imp_tenant" tenant description with normal mode |
| 708 |
ansible.builtin.assert: |
| 709 |
that: |
| 710 |
- nm_idempotency_update_anstest_imp_tenant is not changed |
| 711 |
- nm_idempotency_update_anstest_imp_tenant.current != {} |
| 712 |
- nm_idempotency_update_anstest_imp_tenant.previous != {} |
| 713 |
- nm_idempotency_update_anstest_imp_tenant.current.name == "anstest_imp_tenant" |
| 714 |
- nm_idempotency_update_anstest_imp_tenant.current.displayName == "anstest_imp_tenant_display_name" |
| 715 |
- nm_idempotency_update_anstest_imp_tenant.current.description == "updated_anstest_imp_tenant_description" |
| 716 |
- nm_idempotency_update_anstest_imp_tenant.previous.name == "anstest_imp_tenant" |
| 717 |
- nm_idempotency_update_anstest_imp_tenant.previous.displayName == "anstest_imp_tenant_display_name" |
| 718 |
- nm_idempotency_update_anstest_imp_tenant.previous.description == "updated_anstest_imp_tenant_description" |
| 719 |
|
| 720 |
|
| 721 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with check mode |
| 722 |
cisco.mso.mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_no |
| 723 |
<<: *mso_info |
| 724 |
tenant: anstest_imp_tenant |
| 725 |
orchestrator_only: no |
| 726 |
state: absent |
| 727 |
check_mode: true |
| 728 |
register: cm_anstest_imp_tenant_absent_orchestrator_only_no |
| 729 |
|
| 730 |
- name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with check mode |
| 731 |
ansible.builtin.assert: |
| 732 |
that: |
| 733 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no is changed |
| 734 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} |
| 735 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no.previous != {} |
| 736 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no.previous.name == "anstest_imp_tenant" |
| 737 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no.previous.displayName == "anstest_imp_tenant_display_name" |
| 738 |
- cm_anstest_imp_tenant_absent_orchestrator_only_no.previous.description == "updated_anstest_imp_tenant_description" |
| 739 |
|
| 740 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode |
| 741 |
cisco.mso.mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_no |
| 742 |
<<: *cm_anstest_imp_tenant_absent_orchestrator_only_no |
| 743 |
register: nm_anstest_imp_tenant_absent_orchestrator_only_no |
| 744 |
|
| 745 |
- name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode |
| 746 |
ansible.builtin.assert: |
| 747 |
that: |
| 748 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no is changed |
| 749 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} |
| 750 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no.previous != {} |
| 751 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no.previous.name == "anstest_imp_tenant" |
| 752 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no.previous.displayName == "anstest_imp_tenant_display_name" |
| 753 |
- nm_anstest_imp_tenant_absent_orchestrator_only_no.previous.description == "updated_anstest_imp_tenant_description" |
| 754 |
|
| 755 |
- name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode - idempotency works |
| 756 |
cisco.mso.mso_tenant: |
| 757 |
<<: *nm_anstest_imp_tenant_absent_orchestrator_only_no |
| 758 |
register: idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no |
| 759 |
|
| 760 |
- name: Idempotency assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode |
| 761 |
ansible.builtin.assert: |
| 762 |
that: |
| 763 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no is not changed |
| 764 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} |
| 765 |
- idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no.previous == {} |
| 766 |
|
| 767 |
- name: Remove tenants |
| 768 |
cisco.mso.mso_tenant: |
| 769 |
<<: *tenant_absent |
| 770 |
loop: |
| 771 |
- ansible_test1 |
| 772 |
- ansible_test2 |
| 773 |
- ansible_test3 |
| 774 |
- tenant_with_site |