| 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 |
- name: Set vars |
| 13 |
ansible.builtin.set_fact: |
| 14 |
mso_info: &mso_info |
| 15 |
host: '{{ mso_hostname }}' |
| 16 |
username: '{{ mso_username }}' |
| 17 |
password: '{{ mso_password }}' |
| 18 |
validate_certs: '{{ mso_validate_certs | default(false) }}' |
| 19 |
use_ssl: '{{ mso_use_ssl | default(true) }}' |
| 20 |
use_proxy: '{{ mso_use_proxy | default(true) }}' |
| 21 |
output_level: '{{ mso_output_level | default("debug") }}' |
| 22 |
|
| 23 |
|
| 24 |
- name: Query MSO version |
| 25 |
cisco.mso.mso_version: |
| 26 |
<<: *mso_info |
| 27 |
state: query |
| 28 |
register: version |
| 29 |
|
| 30 |
|
| 31 |
- name: Execute tasks only for MSO version >= 4.3 |
| 32 |
when: version.current.version is version('4.3', '>=') |
| 33 |
block: |
| 34 |
|
| 35 |
- name: Ensure sites exists |
| 36 |
cisco.mso.mso_site: |
| 37 |
<<: *mso_info |
| 38 |
site: '{{ item.site }}' |
| 39 |
apic_username: '{{ apic_username }}' |
| 40 |
apic_password: '{{ apic_password }}' |
| 41 |
apic_site_id: '{{ item.apic_site_id }}' |
| 42 |
urls: |
| 43 |
- https://{{ apic_hostname }} |
| 44 |
state: present |
| 45 |
loop: |
| 46 |
- {site: "ansible_test", apic_site_id: 101} |
| 47 |
- {site: "ansible_test_2", apic_site_id: 102} |
| 48 |
|
| 49 |
- name: Ensure templates do not exist |
| 50 |
cisco.mso.ndo_template: &template_absent |
| 51 |
<<: *mso_info |
| 52 |
name: ansible_fabric_policy_template |
| 53 |
template_type: fabric_policy |
| 54 |
state: absent |
| 55 |
|
| 56 |
- name: Ensure templates exist |
| 57 |
cisco.mso.ndo_template: |
| 58 |
<<: *template_absent |
| 59 |
state: present |
| 60 |
register: nm_create_fabric_policy_template |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
- name: Create a new NTP Policy (check_mode) |
| 65 |
cisco.mso.ndo_ntp_policy: &create_ntp_policy |
| 66 |
<<: *mso_info |
| 67 |
template: ansible_fabric_policy_template |
| 68 |
name: ansible_test_ntp_policy |
| 69 |
description: Ansible NTP policy |
| 70 |
ntp_keys: |
| 71 |
- id: 1 |
| 72 |
key: first_key |
| 73 |
authentication_type: md5 |
| 74 |
trusted: true |
| 75 |
ntp_providers: |
| 76 |
- host: 1.1.1.1 |
| 77 |
minimum_poll_interval: 4 |
| 78 |
maximum_poll_interval: 16 |
| 79 |
management_epg_type: oob |
| 80 |
management_epg: default |
| 81 |
preferred: true |
| 82 |
authentication_key_id: 1 |
| 83 |
admin_state: enabled |
| 84 |
server_state: enabled |
| 85 |
master_mode: enabled |
| 86 |
stratum: 4 |
| 87 |
authentication_state: enabled |
| 88 |
state: present |
| 89 |
check_mode: true |
| 90 |
register: cm_create_new_ntp_policy |
| 91 |
|
| 92 |
- name: Create a new NTP Policy |
| 93 |
cisco.mso.ndo_ntp_policy: |
| 94 |
<<: *create_ntp_policy |
| 95 |
register: nm_create_new_ntp_policy |
| 96 |
|
| 97 |
- name: Create a new NTP Policy again |
| 98 |
cisco.mso.ndo_ntp_policy: |
| 99 |
<<: *create_ntp_policy |
| 100 |
register: nm_create_new_ntp_policy_again |
| 101 |
|
| 102 |
- name: Create another NTP Policy with minimum requirements using identifiers |
| 103 |
cisco.mso.ndo_ntp_policy: &create_ntp_policy_2 |
| 104 |
<<: *mso_info |
| 105 |
template_id: '{{ nm_create_fabric_policy_template.current.templateId }}' |
| 106 |
name: ansible_test_ntp_policy_2 |
| 107 |
state: present |
| 108 |
register: nm_create_another_ntp_policy |
| 109 |
|
| 110 |
- name: Assert NTP Policy was created |
| 111 |
assert: |
| 112 |
that: |
| 113 |
- cm_create_new_ntp_policy is changed |
| 114 |
- cm_create_new_ntp_policy.previous == {} |
| 115 |
- cm_create_new_ntp_policy.current.name == "ansible_test_ntp_policy" |
| 116 |
- cm_create_new_ntp_policy.current.description == "Ansible NTP policy" |
| 117 |
- cm_create_new_ntp_policy.current.ntpKeys | length == 1 |
| 118 |
- cm_create_new_ntp_policy.current.ntpKeys.0.id == 1 |
| 119 |
- cm_create_new_ntp_policy.current.ntpKeys.0.authType == "md5" |
| 120 |
- cm_create_new_ntp_policy.current.ntpKeys.0.trusted == true |
| 121 |
- cm_create_new_ntp_policy.current.ntpProviders | length == 1 |
| 122 |
- cm_create_new_ntp_policy.current.ntpProviders.0.host == "1.1.1.1" |
| 123 |
- cm_create_new_ntp_policy.current.ntpProviders.0.minPollInterval == 4 |
| 124 |
- cm_create_new_ntp_policy.current.ntpProviders.0.maxPollInterval == 16 |
| 125 |
- cm_create_new_ntp_policy.current.ntpProviders.0.mgmtEpgType == "oob" |
| 126 |
- cm_create_new_ntp_policy.current.ntpProviders.0.mgmtEpgName == "default" |
| 127 |
- cm_create_new_ntp_policy.current.ntpProviders.0.preferred == true |
| 128 |
- cm_create_new_ntp_policy.current.ntpProviders.0.authKeyID == 1 |
| 129 |
- cm_create_new_ntp_policy.current.adminState == "enabled" |
| 130 |
- cm_create_new_ntp_policy.current.serverState == "enabled" |
| 131 |
- cm_create_new_ntp_policy.current.masterMode == "enabled" |
| 132 |
- cm_create_new_ntp_policy.current.stratum == 4 |
| 133 |
- cm_create_new_ntp_policy.current.authState == "enabled" |
| 134 |
- nm_create_new_ntp_policy is changed |
| 135 |
- nm_create_new_ntp_policy.previous == {} |
| 136 |
- nm_create_new_ntp_policy.current.name == "ansible_test_ntp_policy" |
| 137 |
- nm_create_new_ntp_policy.current.description == "Ansible NTP policy" |
| 138 |
- nm_create_new_ntp_policy.current.ntpKeys | length == 1 |
| 139 |
- nm_create_new_ntp_policy.current.ntpKeys.0.id == 1 |
| 140 |
- nm_create_new_ntp_policy.current.ntpKeys.0.authType == "md5" |
| 141 |
- nm_create_new_ntp_policy.current.ntpKeys.0.trusted == true |
| 142 |
- nm_create_new_ntp_policy.current.ntpProviders | length == 1 |
| 143 |
- nm_create_new_ntp_policy.current.ntpProviders.0.host == "1.1.1.1" |
| 144 |
- nm_create_new_ntp_policy.current.ntpProviders.0.minPollInterval == 4 |
| 145 |
- nm_create_new_ntp_policy.current.ntpProviders.0.maxPollInterval == 16 |
| 146 |
- nm_create_new_ntp_policy.current.ntpProviders.0.mgmtEpgType == "oob" |
| 147 |
- nm_create_new_ntp_policy.current.ntpProviders.0.mgmtEpgName == "default" |
| 148 |
- nm_create_new_ntp_policy.current.ntpProviders.0.preferred == true |
| 149 |
- nm_create_new_ntp_policy.current.ntpProviders.0.authKeyID == 1 |
| 150 |
- nm_create_new_ntp_policy.current.adminState == "enabled" |
| 151 |
- nm_create_new_ntp_policy.current.serverState == "enabled" |
| 152 |
- nm_create_new_ntp_policy.current.masterMode == "enabled" |
| 153 |
- nm_create_new_ntp_policy.current.stratum == 4 |
| 154 |
- nm_create_new_ntp_policy.current.authState == "enabled" |
| 155 |
- nm_create_new_ntp_policy.current.uuid is defined |
| 156 |
- nm_create_new_ntp_policy_again is not changed |
| 157 |
- nm_create_new_ntp_policy_again.previous.name == "ansible_test_ntp_policy" |
| 158 |
- nm_create_new_ntp_policy_again.previous.description == "Ansible NTP policy" |
| 159 |
- nm_create_new_ntp_policy_again.previous.ntpKeys | length == 1 |
| 160 |
- nm_create_new_ntp_policy_again.previous.ntpKeys.0.id == 1 |
| 161 |
- nm_create_new_ntp_policy_again.previous.ntpKeys.0.authType == "md5" |
| 162 |
- nm_create_new_ntp_policy_again.previous.ntpKeys.0.trusted == true |
| 163 |
- nm_create_new_ntp_policy_again.previous.ntpProviders | length == 1 |
| 164 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.host == "1.1.1.1" |
| 165 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.minPollInterval == 4 |
| 166 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.maxPollInterval == 16 |
| 167 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.mgmtEpgType == "oob" |
| 168 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.mgmtEpgName == "default" |
| 169 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.preferred == true |
| 170 |
- nm_create_new_ntp_policy_again.previous.ntpProviders.0.authKeyID == 1 |
| 171 |
- nm_create_new_ntp_policy_again.previous.adminState == "enabled" |
| 172 |
- nm_create_new_ntp_policy_again.previous.serverState == "enabled" |
| 173 |
- nm_create_new_ntp_policy_again.previous.masterMode == "enabled" |
| 174 |
- nm_create_new_ntp_policy_again.previous.stratum == 4 |
| 175 |
- nm_create_new_ntp_policy_again.previous.authState == "enabled" |
| 176 |
- nm_create_new_ntp_policy_again.previous.uuid is defined |
| 177 |
- nm_create_new_ntp_policy_again.current.name == "ansible_test_ntp_policy" |
| 178 |
- nm_create_new_ntp_policy_again.current.description == "Ansible NTP policy" |
| 179 |
- nm_create_new_ntp_policy_again.current.ntpKeys | length == 1 |
| 180 |
- nm_create_new_ntp_policy_again.current.ntpKeys.0.id == 1 |
| 181 |
- nm_create_new_ntp_policy_again.current.ntpKeys.0.authType == "md5" |
| 182 |
- nm_create_new_ntp_policy_again.current.ntpKeys.0.trusted == true |
| 183 |
- nm_create_new_ntp_policy_again.current.ntpProviders | length == 1 |
| 184 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.host == "1.1.1.1" |
| 185 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.minPollInterval == 4 |
| 186 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.maxPollInterval == 16 |
| 187 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.mgmtEpgType == "oob" |
| 188 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.mgmtEpgName == "default" |
| 189 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.preferred == true |
| 190 |
- nm_create_new_ntp_policy_again.current.ntpProviders.0.authKeyID == 1 |
| 191 |
- nm_create_new_ntp_policy_again.current.adminState == "enabled" |
| 192 |
- nm_create_new_ntp_policy_again.current.serverState == "enabled" |
| 193 |
- nm_create_new_ntp_policy_again.current.masterMode == "enabled" |
| 194 |
- nm_create_new_ntp_policy_again.current.stratum == 4 |
| 195 |
- nm_create_new_ntp_policy_again.current.authState == "enabled" |
| 196 |
- nm_create_new_ntp_policy_again.current.uuid is defined |
| 197 |
- nm_create_another_ntp_policy is changed |
| 198 |
- nm_create_another_ntp_policy.previous == {} |
| 199 |
- nm_create_another_ntp_policy.current.name == "ansible_test_ntp_policy_2" |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
- name: Update a NTP Policy (check_mode) |
| 204 |
cisco.mso.ndo_ntp_policy: &update_ntp_policy |
| 205 |
<<: *create_ntp_policy |
| 206 |
description: New Ansible NTP policy |
| 207 |
check_mode: true |
| 208 |
register: cm_update_ntp_policy |
| 209 |
|
| 210 |
- name: Update a NTP Policy |
| 211 |
cisco.mso.ndo_ntp_policy: |
| 212 |
<<: *update_ntp_policy |
| 213 |
register: nm_update_ntp_policy |
| 214 |
|
| 215 |
- name: Update a NTP Policy again |
| 216 |
cisco.mso.ndo_ntp_policy: |
| 217 |
<<: *update_ntp_policy |
| 218 |
register: nm_update_ntp_policy_again |
| 219 |
|
| 220 |
- name: Add a NTP Provider and a NTP client key to NTP Policy |
| 221 |
cisco.mso.ndo_ntp_policy: &add_ntp_policy_providers_keys |
| 222 |
<<: *update_ntp_policy |
| 223 |
ntp_keys: |
| 224 |
- id: 1 |
| 225 |
key: first_key |
| 226 |
authentication_type: md5 |
| 227 |
trusted: true |
| 228 |
- id: 2 |
| 229 |
key: second_key |
| 230 |
authentication_type: md5 |
| 231 |
trusted: false |
| 232 |
ntp_providers: |
| 233 |
- host: 1.1.1.1 |
| 234 |
minimum_poll_interval: 4 |
| 235 |
maximum_poll_interval: 16 |
| 236 |
management_epg_type: oob |
| 237 |
management_epg: default |
| 238 |
preferred: true |
| 239 |
authentication_key_id: 1 |
| 240 |
- host: 1.1.1.2 |
| 241 |
minimum_poll_interval: 5 |
| 242 |
maximum_poll_interval: 15 |
| 243 |
management_epg_type: oob |
| 244 |
management_epg: default |
| 245 |
preferred: false |
| 246 |
authentication_key_id: 2 |
| 247 |
register: nm_add_ntp_policy_providers_keys |
| 248 |
|
| 249 |
- name: Remove NTP providers from NTP Policy |
| 250 |
cisco.mso.ndo_ntp_policy: &remove_ntp_policy_providers |
| 251 |
<<: *add_ntp_policy_providers_keys |
| 252 |
ntp_providers: [] |
| 253 |
register: nm_remove_ntp_policy_providers |
| 254 |
|
| 255 |
- name: Remove NTP providers from NTP Policy again |
| 256 |
cisco.mso.ndo_ntp_policy: |
| 257 |
<<: *remove_ntp_policy_providers |
| 258 |
register: nm_remove_ntp_policy_providers_again |
| 259 |
|
| 260 |
- name: Assert NTP Policy was updated |
| 261 |
assert: |
| 262 |
that: |
| 263 |
- cm_update_ntp_policy is changed |
| 264 |
- cm_update_ntp_policy.previous.name == "ansible_test_ntp_policy" |
| 265 |
- cm_update_ntp_policy.previous.description == "Ansible NTP policy" |
| 266 |
- cm_update_ntp_policy.previous.uuid is defined |
| 267 |
- cm_update_ntp_policy.current.name == "ansible_test_ntp_policy" |
| 268 |
- cm_update_ntp_policy.current.description == "New Ansible NTP policy" |
| 269 |
- cm_update_ntp_policy.current.uuid is defined |
| 270 |
- nm_update_ntp_policy is changed |
| 271 |
- nm_update_ntp_policy.previous.name == "ansible_test_ntp_policy" |
| 272 |
- nm_update_ntp_policy.previous.description == "Ansible NTP policy" |
| 273 |
- nm_update_ntp_policy.previous.uuid is defined |
| 274 |
- nm_update_ntp_policy.current.name == "ansible_test_ntp_policy" |
| 275 |
- nm_update_ntp_policy.current.description == "New Ansible NTP policy" |
| 276 |
- nm_update_ntp_policy.current.uuid is defined |
| 277 |
- nm_update_ntp_policy_again is not changed |
| 278 |
- nm_update_ntp_policy_again.previous.name == "ansible_test_ntp_policy" |
| 279 |
- nm_update_ntp_policy_again.previous.description == "New Ansible NTP policy" |
| 280 |
- nm_update_ntp_policy_again.previous.uuid is defined |
| 281 |
- nm_update_ntp_policy_again.current.name == "ansible_test_ntp_policy" |
| 282 |
- nm_update_ntp_policy_again.current.description == "New Ansible NTP policy" |
| 283 |
- nm_update_ntp_policy_again.current.uuid is defined |
| 284 |
- nm_add_ntp_policy_providers_keys is changed |
| 285 |
- nm_add_ntp_policy_providers_keys.previous.name == "ansible_test_ntp_policy" |
| 286 |
- nm_add_ntp_policy_providers_keys.previous.description == "New Ansible NTP policy" |
| 287 |
- nm_add_ntp_policy_providers_keys.previous.ntpKeys | length == 1 |
| 288 |
- nm_add_ntp_policy_providers_keys.previous.ntpKeys.0.id == 1 |
| 289 |
- nm_add_ntp_policy_providers_keys.previous.ntpKeys.0.authType == "md5" |
| 290 |
- nm_add_ntp_policy_providers_keys.previous.ntpKeys.0.trusted == true |
| 291 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders | length == 1 |
| 292 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.host == "1.1.1.1" |
| 293 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.minPollInterval == 4 |
| 294 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.maxPollInterval == 16 |
| 295 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.mgmtEpgType == "oob" |
| 296 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.mgmtEpgName == "default" |
| 297 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.preferred == true |
| 298 |
- nm_add_ntp_policy_providers_keys.previous.ntpProviders.0.authKeyID == 1 |
| 299 |
- nm_add_ntp_policy_providers_keys.previous.uuid is defined |
| 300 |
- nm_add_ntp_policy_providers_keys.current.name == "ansible_test_ntp_policy" |
| 301 |
- nm_add_ntp_policy_providers_keys.current.description == "New Ansible NTP policy" |
| 302 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys | length == 2 |
| 303 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.0.id == 1 |
| 304 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.0.authType == "md5" |
| 305 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.0.trusted == true |
| 306 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.1.id == 2 |
| 307 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.1.authType == "md5" |
| 308 |
- nm_add_ntp_policy_providers_keys.current.ntpKeys.1.trusted == false |
| 309 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders | length == 2 |
| 310 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.host == "1.1.1.1" |
| 311 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.minPollInterval == 4 |
| 312 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.maxPollInterval == 16 |
| 313 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.mgmtEpgType == "oob" |
| 314 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.mgmtEpgName == "default" |
| 315 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.preferred == true |
| 316 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.0.authKeyID == 1 |
| 317 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.host == "1.1.1.2" |
| 318 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.minPollInterval == 5 |
| 319 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.maxPollInterval == 15 |
| 320 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.mgmtEpgType == "oob" |
| 321 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.mgmtEpgName == "default" |
| 322 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.preferred == false |
| 323 |
- nm_add_ntp_policy_providers_keys.current.ntpProviders.1.authKeyID == 2 |
| 324 |
- nm_add_ntp_policy_providers_keys.current.uuid is defined |
| 325 |
- nm_remove_ntp_policy_providers is changed |
| 326 |
- nm_remove_ntp_policy_providers.previous.name == "ansible_test_ntp_policy" |
| 327 |
- nm_remove_ntp_policy_providers.previous.description == "New Ansible NTP policy" |
| 328 |
- nm_remove_ntp_policy_providers.previous.ntpProviders | length == 2 |
| 329 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.host == "1.1.1.1" |
| 330 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.minPollInterval == 4 |
| 331 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.maxPollInterval == 16 |
| 332 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.mgmtEpgType == "oob" |
| 333 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.mgmtEpgName == "default" |
| 334 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.preferred == true |
| 335 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.0.authKeyID == 1 |
| 336 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.host == "1.1.1.2" |
| 337 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.minPollInterval == 5 |
| 338 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.maxPollInterval == 15 |
| 339 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.mgmtEpgType == "oob" |
| 340 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.mgmtEpgName == "default" |
| 341 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.preferred == false |
| 342 |
- nm_remove_ntp_policy_providers.previous.ntpProviders.1.authKeyID == 2 |
| 343 |
- nm_remove_ntp_policy_providers.previous.uuid is defined |
| 344 |
- nm_remove_ntp_policy_providers.current.name == "ansible_test_ntp_policy" |
| 345 |
- nm_remove_ntp_policy_providers.current.description == "New Ansible NTP policy" |
| 346 |
- nm_remove_ntp_policy_providers.current.ntpProviders is not defined |
| 347 |
- nm_remove_ntp_policy_providers.current.uuid is defined |
| 348 |
- nm_remove_ntp_policy_providers_again is not changed |
| 349 |
- nm_remove_ntp_policy_providers_again.previous.name == "ansible_test_ntp_policy" |
| 350 |
- nm_remove_ntp_policy_providers_again.previous.description == "New Ansible NTP policy" |
| 351 |
- nm_remove_ntp_policy_providers_again.previous.ntpProviders is not defined |
| 352 |
- nm_remove_ntp_policy_providers_again.previous.uuid is defined |
| 353 |
- nm_remove_ntp_policy_providers_again.current.name == "ansible_test_ntp_policy" |
| 354 |
- nm_remove_ntp_policy_providers_again.current.description == "New Ansible NTP policy" |
| 355 |
- nm_remove_ntp_policy_providers_again.current.ntpProviders is not defined |
| 356 |
- nm_remove_ntp_policy_providers_again.current.uuid is defined |
| 357 |
|
| 358 |
- name: Update a NTP Policy name |
| 359 |
cisco.mso.ndo_ntp_policy: &update_ntp_policy_name |
| 360 |
<<: *remove_ntp_policy_providers |
| 361 |
uuid: '{{ nm_update_ntp_policy.current.uuid }}' |
| 362 |
name: ansible_test_ntp_policy_changed |
| 363 |
register: nm_update_ntp_policy_name |
| 364 |
|
| 365 |
- name: Assert NTP Policy was updated |
| 366 |
assert: |
| 367 |
that: |
| 368 |
- nm_update_ntp_policy_name is changed |
| 369 |
- nm_update_ntp_policy_name.previous.name == "ansible_test_ntp_policy" |
| 370 |
- nm_update_ntp_policy_name.current.name == "ansible_test_ntp_policy_changed" |
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
- name: Query a NTP Policy with template_name |
| 375 |
cisco.mso.ndo_ntp_policy: |
| 376 |
<<: *create_ntp_policy_2 |
| 377 |
state: query |
| 378 |
register: query_one |
| 379 |
|
| 380 |
- name: Query a NTP Policy with template_name and UUID |
| 381 |
cisco.mso.ndo_ntp_policy: &query_ntp_policy_uuid |
| 382 |
<<: *create_ntp_policy_2 |
| 383 |
uuid: '{{ query_one.current.uuid }}' |
| 384 |
name: '{{ fakevar | default(omit)}}' |
| 385 |
state: query |
| 386 |
register: query_one_uuid |
| 387 |
|
| 388 |
- name: Query all NTP Policy in the template with template name |
| 389 |
cisco.mso.ndo_ntp_policy: |
| 390 |
<<: *mso_info |
| 391 |
template: ansible_fabric_policy_template |
| 392 |
state: query |
| 393 |
register: query_all_with_name |
| 394 |
|
| 395 |
- name: Query all NTP Policy in the template with template id |
| 396 |
cisco.mso.ndo_ntp_policy: |
| 397 |
<<: *mso_info |
| 398 |
template_id: '{{ nm_create_fabric_policy_template.current.templateId }}' |
| 399 |
state: query |
| 400 |
register: query_all_with_id |
| 401 |
|
| 402 |
- name: Assert NTP Policy was queried |
| 403 |
assert: |
| 404 |
that: |
| 405 |
- query_one is not changed |
| 406 |
- query_one.current.name == "ansible_test_ntp_policy_2" |
| 407 |
- query_one_uuid is not changed |
| 408 |
- query_one_uuid.current.name == "ansible_test_ntp_policy_2" |
| 409 |
- query_all_with_name is not changed |
| 410 |
- query_all_with_name.current.0.name == "ansible_test_ntp_policy_changed" |
| 411 |
- query_all_with_name.current.1.name == "ansible_test_ntp_policy_2" |
| 412 |
- query_all_with_name.current | length == 2 |
| 413 |
- query_all_with_id is not changed |
| 414 |
- query_all_with_id.current.0.name == "ansible_test_ntp_policy_changed" |
| 415 |
- query_all_with_id.current.1.name == "ansible_test_ntp_policy_2" |
| 416 |
- query_all_with_id.current | length == 2 |
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
- name: Delete a NTP Policy (check_mode) |
| 421 |
cisco.mso.ndo_ntp_policy: &delete_ntp_policy |
| 422 |
<<: *update_ntp_policy_name |
| 423 |
state: absent |
| 424 |
check_mode: true |
| 425 |
register: cm_delete_ntp_policy |
| 426 |
|
| 427 |
- name: Delete a NTP Policy |
| 428 |
cisco.mso.ndo_ntp_policy: |
| 429 |
<<: *delete_ntp_policy |
| 430 |
register: nm_delete_ntp_policy |
| 431 |
|
| 432 |
- name: Delete a NTP Policy again |
| 433 |
cisco.mso.ndo_ntp_policy: |
| 434 |
<<: *delete_ntp_policy |
| 435 |
register: nm_delete_ntp_policy_again |
| 436 |
|
| 437 |
- name: Assert NTP Policy was deleted |
| 438 |
assert: |
| 439 |
that: |
| 440 |
- cm_delete_ntp_policy is changed |
| 441 |
- cm_delete_ntp_policy.previous.name == "ansible_test_ntp_policy_changed" |
| 442 |
- cm_delete_ntp_policy.previous.description == "New Ansible NTP policy" |
| 443 |
- cm_delete_ntp_policy.previous.uuid is defined |
| 444 |
- nm_delete_ntp_policy.current == {} |
| 445 |
- nm_delete_ntp_policy is changed |
| 446 |
- nm_delete_ntp_policy.previous.name == "ansible_test_ntp_policy_changed" |
| 447 |
- nm_delete_ntp_policy.previous.description == "New Ansible NTP policy" |
| 448 |
- nm_delete_ntp_policy.previous.uuid is defined |
| 449 |
- nm_delete_ntp_policy.current == {} |
| 450 |
- nm_delete_ntp_policy_again is not changed |
| 451 |
- nm_delete_ntp_policy_again.previous == {} |
| 452 |
- nm_delete_ntp_policy_again.current == {} |
| 453 |
|
| 454 |
- name: Delete a NTP Policy with UUID |
| 455 |
cisco.mso.ndo_ntp_policy: |
| 456 |
<<: *query_ntp_policy_uuid |
| 457 |
state: absent |
| 458 |
register: nm_delete_ntp_policy_uuid |
| 459 |
|
| 460 |
- name: Assert NTP Policy was deleted with UUID |
| 461 |
assert: |
| 462 |
that: |
| 463 |
- nm_delete_ntp_policy_uuid is changed |
| 464 |
- nm_delete_ntp_policy_uuid.previous.name == "ansible_test_ntp_policy_2" |
| 465 |
- nm_delete_ntp_policy_uuid.current == {} |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
- name: Query all NTP Policy in the template when all are deleted |
| 470 |
cisco.mso.ndo_ntp_policy: |
| 471 |
<<: *mso_info |
| 472 |
template: ansible_fabric_policy_template |
| 473 |
state: query |
| 474 |
register: query_all_with_name_none |
| 475 |
|
| 476 |
- name: Update with non-existing UUID |
| 477 |
cisco.mso.ndo_ntp_policy: |
| 478 |
<<: *mso_info |
| 479 |
template: ansible_fabric_policy_template |
| 480 |
uuid: non-existing-uuid |
| 481 |
state: present |
| 482 |
ignore_errors: true |
| 483 |
register: update_non_existing_uuid |
| 484 |
|
| 485 |
- name: Set error message for non_existing_uuid |
| 486 |
ansible.builtin.set_fact: |
| 487 |
error_message_non_existing_uuid: "NTP Policy with the UUID: 'non-existing-uuid' not found" |
| 488 |
|
| 489 |
- name: Assert no NTP Policy found |
| 490 |
assert: |
| 491 |
that: |
| 492 |
- query_all_with_name_none is not changed |
| 493 |
- query_all_with_name_none.current == {} |
| 494 |
- update_non_existing_uuid is failed |
| 495 |
- update_non_existing_uuid.msg == error_message_non_existing_uuid |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
- name: Ensure templates do not exist |
| 500 |
cisco.mso.ndo_template: |
| 501 |
<<: *template_absent |