| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
- name: Test that we have an ACI APIC host, ACI username and ACI password |
| 7 |
ansible.builtin.fail: |
| 8 |
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.' |
| 9 |
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined |
| 10 |
|
| 11 |
|
| 12 |
- name: Set vars |
| 13 |
ansible.builtin.set_fact: |
| 14 |
aci_info: &aci_info |
| 15 |
host: "{{ aci_hostname }}" |
| 16 |
username: "{{ aci_username }}" |
| 17 |
password: "{{ aci_password }}" |
| 18 |
validate_certs: '{{ aci_validate_certs | default(false) }}' |
| 19 |
use_ssl: '{{ aci_use_ssl | default(true) }}' |
| 20 |
use_proxy: '{{ aci_use_proxy | default(true) }}' |
| 21 |
output_level: debug |
| 22 |
|
| 23 |
|
| 24 |
- name: Query system information |
| 25 |
cisco.aci.aci_system: |
| 26 |
<<: *aci_info |
| 27 |
id: 1 |
| 28 |
state: query |
| 29 |
register: version |
| 30 |
|
| 31 |
- name: Verify Cloud and Non-Cloud Sites in use. |
| 32 |
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
| 33 |
|
| 34 |
- name: Execute tasks only for non-cloud sites |
| 35 |
when: |
| 36 |
- query_cloud.current == [] |
| 37 |
- version.current.0.topSystem.attributes.version is version('4.2', '>=') |
| 38 |
block: |
| 39 |
|
| 40 |
- name: Remove ansible_domain if it already exists |
| 41 |
cisco.aci.aci_domain: |
| 42 |
<<: *aci_info |
| 43 |
domain: ansible_domain |
| 44 |
domain_type: vmm |
| 45 |
vm_provider: vmware |
| 46 |
state: absent |
| 47 |
|
| 48 |
|
| 49 |
- name: Create ansible_domain |
| 50 |
cisco.aci.aci_domain: |
| 51 |
<<: *aci_info |
| 52 |
domain: ansible_domain |
| 53 |
domain_type: vmm |
| 54 |
vm_provider: vmware |
| 55 |
state: present |
| 56 |
|
| 57 |
|
| 58 |
- name: Create VMWare Uplink Container |
| 59 |
cisco.aci.aci_vmm_uplink_container: |
| 60 |
<<: *aci_info |
| 61 |
domain: ansible_domain |
| 62 |
num_of_uplinks: 1 |
| 63 |
state: present |
| 64 |
|
| 65 |
|
| 66 |
- name: Create VMWare Uplink |
| 67 |
cisco.aci.aci_vmm_uplink: |
| 68 |
<<: *aci_info |
| 69 |
domain: ansible_domain |
| 70 |
uplink_id: 1 |
| 71 |
uplink_name: uplink1 |
| 72 |
state: present |
| 73 |
register: create_uplink |
| 74 |
|
| 75 |
- name: Verify Uplink Creation |
| 76 |
ansible.builtin.assert: |
| 77 |
that: |
| 78 |
- create_uplink.current.0.vmmUplinkP.attributes.dn == "uni/vmmp-VMware/dom-ansible_domain/uplinkpcont/uplinkp-1" |
| 79 |
- create_uplink.current.0.vmmUplinkP.attributes.uplinkId == "1" |
| 80 |
- create_uplink.current.0.vmmUplinkP.attributes.uplinkName == "uplink1" |
| 81 |
- create_uplink.current.0.vmmUplinkP.attributes.annotation == 'orchestrator:ansible' |
| 82 |
|
| 83 |
|
| 84 |
- name: Create VMWare Uplink again |
| 85 |
cisco.aci.aci_vmm_uplink: |
| 86 |
<<: *aci_info |
| 87 |
domain: ansible_domain |
| 88 |
uplink_id: 1 |
| 89 |
uplink_name: uplink1 |
| 90 |
state: present |
| 91 |
register: create_uplink_again |
| 92 |
|
| 93 |
- name: Verify Uplink Creation idempotence |
| 94 |
ansible.builtin.assert: |
| 95 |
that: |
| 96 |
- create_uplink_again is not changed |
| 97 |
- create_uplink_again.current.0.vmmUplinkP.attributes.dn == "uni/vmmp-VMware/dom-ansible_domain/uplinkpcont/uplinkp-1" |
| 98 |
- create_uplink_again.current.0.vmmUplinkP.attributes.uplinkId == "1" |
| 99 |
- create_uplink_again.current.0.vmmUplinkP.attributes.uplinkName == "uplink1" |
| 100 |
|
| 101 |
|
| 102 |
- name: Create VMWare Uplink again |
| 103 |
cisco.aci.aci_vmm_uplink: |
| 104 |
<<: *aci_info |
| 105 |
domain: ansible_domain |
| 106 |
uplink_id: 1 |
| 107 |
uplink_name: updated_uplink |
| 108 |
state: present |
| 109 |
register: update_uplink |
| 110 |
|
| 111 |
- name: Verify Uplink update |
| 112 |
ansible.builtin.assert: |
| 113 |
that: |
| 114 |
- update_uplink is changed |
| 115 |
- update_uplink.current.0.vmmUplinkP.attributes.dn == "uni/vmmp-VMware/dom-ansible_domain/uplinkpcont/uplinkp-1" |
| 116 |
- update_uplink.current.0.vmmUplinkP.attributes.uplinkId == "1" |
| 117 |
- update_uplink.current.0.vmmUplinkP.attributes.uplinkName == "updated_uplink" |
| 118 |
|
| 119 |
|
| 120 |
- name: Query VMWare Uplink |
| 121 |
cisco.aci.aci_vmm_uplink: |
| 122 |
<<: *aci_info |
| 123 |
domain: ansible_domain |
| 124 |
uplink_id: 1 |
| 125 |
state: query |
| 126 |
register: query_uplink |
| 127 |
|
| 128 |
- name: Verify Uplink query |
| 129 |
ansible.builtin.assert: |
| 130 |
that: |
| 131 |
- query_uplink is not changed |
| 132 |
- query_uplink.current.0.vmmUplinkP.attributes.dn == "uni/vmmp-VMware/dom-ansible_domain/uplinkpcont/uplinkp-1" |
| 133 |
- query_uplink.current.0.vmmUplinkP.attributes.uplinkId == "1" |
| 134 |
- query_uplink.current.0.vmmUplinkP.attributes.uplinkName == "updated_uplink" |
| 135 |
|
| 136 |
|
| 137 |
- name: Delete VMWare Uplink |
| 138 |
cisco.aci.aci_vmm_uplink: |
| 139 |
<<: *aci_info |
| 140 |
domain: ansible_domain |
| 141 |
uplink_id: 1 |
| 142 |
state: absent |
| 143 |
register: remove_uplink |
| 144 |
|
| 145 |
- name: Verify VMWare Uplink deletion |
| 146 |
ansible.builtin.assert: |
| 147 |
that: |
| 148 |
- remove_uplink is changed |
| 149 |
- remove_uplink.current == [] |
| 150 |
- remove_uplink.previous.0.vmmUplinkP.attributes.dn == "uni/vmmp-VMware/dom-ansible_domain/uplinkpcont/uplinkp-1" |
| 151 |
- remove_uplink.previous.0.vmmUplinkP.attributes.uplinkId == "1" |
| 152 |
- remove_uplink.previous.0.vmmUplinkP.attributes.uplinkName == "updated_uplink" |
| 153 |
|
| 154 |
|
| 155 |
- name: Delete VMWare Uplink again |
| 156 |
cisco.aci.aci_vmm_uplink: |
| 157 |
<<: *aci_info |
| 158 |
domain: ansible_domain |
| 159 |
uplink_id: 1 |
| 160 |
state: absent |
| 161 |
register: remove_uplink_again |
| 162 |
|
| 163 |
- name: Verify VMWare Uplink deletion idempotence |
| 164 |
ansible.builtin.assert: |
| 165 |
that: |
| 166 |
- remove_uplink_again is not changed |
| 167 |
|
| 168 |
|
| 169 |
- name: Remove ansible_domain |
| 170 |
cisco.aci.aci_domain: |
| 171 |
<<: *aci_info |
| 172 |
domain: ansible_domain |
| 173 |
domain_type: vmm |
| 174 |
vm_provider: vmware |
| 175 |
state: absent |