Debian Codegraph @

ansible_collections/cisco/aci/tests/integration/targets/aci_domain/tasks/vmm-vmware.yml

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2018, Dag Wieers (@dagwieers) <[email protected]>
3
4 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 # CLEAN ENVIRONMENT
7 - name: Remove VMM domain
8 cisco.aci.aci_domain: &domain_absent
9 host: "{{ aci_hostname }}"
10 username: "{{ aci_username }}"
11 password: "{{ aci_password }}"
12 validate_certs: '{{ aci_validate_certs | default(false) }}'
13 use_ssl: '{{ aci_use_ssl | default(true) }}'
14 use_proxy: '{{ aci_use_proxy | default(true) }}'
15 output_level: '{{ aci_output_level | default("info") }}'
16 domain: vmm_dom
17 domain_type: vmm
18 vm_provider: vmware
19 state: absent
20
21 - name: Verify Cloud and Non-Cloud Sites in use.
22 ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
23
24 - name: Execute tasks only for non-cloud sites
25 when: query_cloud.current == [] # This condition will skip execution for cloud sites
26 block:
27 # ADD DOMAIN
28 - name: Add VMM domain (check_mode)
29 cisco.aci.aci_domain: &domain_present
30 host: '{{ aci_hostname }}'
31 username: '{{ aci_username }}'
32 password: '{{ aci_password }}'
33 validate_certs: '{{ aci_validate_certs | default(false) }}'
34 use_ssl: '{{ aci_use_ssl | default(true) }}'
35 use_proxy: '{{ aci_use_proxy | default(true) }}'
36 output_level: '{{ aci_output_level | default("info") }}'
37 domain: vmm_dom
38 domain_type: vmm
39 vm_provider: vmware
40 access_mode: read-write
41 enable_vm_folder: true
42 state: present
43 check_mode: true
44 register: cm_add_domain
45
46 - name: Add VMM domain (normal mode)
47 cisco.aci.aci_domain: *domain_present
48 register: nm_add_domain
49
50 - name: Verify VMM add_domain
51 ansible.builtin.assert:
52 that:
53 - cm_add_domain is changed
54 - nm_add_domain is changed
55 - cm_add_domain.sent.vmmDomP.attributes.name == nm_add_domain.sent.vmmDomP.attributes.name == 'vmm_dom'
56 - cm_add_domain.proposed.vmmDomP.attributes.name == nm_add_domain.proposed.vmmDomP.attributes.name == 'vmm_dom'
57 - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == []
58 - nm_add_domain.current.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom'
59 - nm_add_domain.current.0.vmmDomP.attributes.name == 'vmm_dom'
60 - nm_add_domain.current.0.vmmDomP.attributes.annotation == 'orchestrator:ansible'
61
62 - name: Add VMM domain again (check_mode)
63 cisco.aci.aci_domain: *domain_present
64 check_mode: true
65 register: cm_add_domain_again
66
67 - name: Add VMM domain again (normal mode)
68 cisco.aci.aci_domain: *domain_present
69 register: nm_add_domain_again
70
71 - name: Verify VMM add_domain_again
72 ansible.builtin.assert:
73 that:
74 - cm_add_domain_again is not changed
75 - nm_add_domain_again is not changed
76
77 - name: Update VMM domain with tag collection and infra port groups (check_mode)
78 cisco.aci.aci_domain:
79 <<: *domain_present
80 add_infra_pg: true
81 tag_collection: true
82 check_mode: true
83 register: cm_update_domain
84 when: version.current.0.topSystem.attributes.version is version('4.1', '>=')
85
86 - name: Update VMM domain with tag collection and infra port groups (normal mode)
87 cisco.aci.aci_domain:
88 <<: *domain_present
89 add_infra_pg: true
90 tag_collection: true
91 register: nm_update_domain
92 when: version.current.0.topSystem.attributes.version is version('4.1', '>=')
93
94 - name: Verify update_domain
95 ansible.builtin.assert:
96 that:
97 - cm_update_domain is changed
98 - nm_update_domain is changed
99 - cm_update_domain.previous.0.vmmDomP.attributes.configInfraPg == nm_update_domain.previous.0.vmmDomP.attributes.configInfraPg == 'no'
100 - cm_update_domain.proposed.vmmDomP.attributes.configInfraPg == nm_update_domain.current.0.vmmDomP.attributes.configInfraPg == 'yes'
101 - cm_update_domain.previous.0.vmmDomP.attributes.enableTag == nm_update_domain.previous.0.vmmDomP.attributes.enableTag == 'no'
102 - cm_update_domain.proposed.vmmDomP.attributes.enableTag == nm_update_domain.current.0.vmmDomP.attributes.enableTag == 'yes'
103 when: version.current.0.topSystem.attributes.version is version('4.1', '>=')
104
105 # QUERY ALL DOMAINS
106 - name: Query all VMM domains (check_mode)
107 cisco.aci.aci_domain: &domain_query
108 host: '{{ aci_hostname }}'
109 username: '{{ aci_username }}'
110 password: '{{ aci_password }}'
111 validate_certs: '{{ aci_validate_certs | default(false) }}'
112 use_ssl: '{{ aci_use_ssl | default(true) }}'
113 use_proxy: '{{ aci_use_proxy | default(true) }}'
114 output_level: '{{ aci_output_level | default("info") }}'
115 domain_type: vmm
116 vm_provider: vmware
117 state: query
118 check_mode: true
119 register: cm_query_all_domains
120
121 - name: Query all VMM domains (normal mode)
122 cisco.aci.aci_domain: *domain_query
123 register: nm_query_all_domains
124
125 - name: Verify query_all_domains
126 ansible.builtin.assert:
127 that:
128 - cm_query_all_domains is not changed
129 - nm_query_all_domains is not changed
130 - cm_query_all_domains == nm_query_all_domains
131 - nm_query_all_domains.current|length >= 1
132
133
134 # QUERY A DOMAIN
135 - name: Query our VMM domain (check_mode)
136 cisco.aci.aci_domain:
137 <<: *domain_query
138 domain: vmm_dom
139 vm_provider: vmware
140 check_mode: true
141 register: cm_query_domain
142
143 - name: Query our VMM domain (normal mode)
144 cisco.aci.aci_domain:
145 <<: *domain_query
146 domain: vmm_dom
147 vm_provider: vmware
148 register: nm_query_domain
149
150 - name: Verify VMM query_domain
151 ansible.builtin.assert:
152 that:
153 - cm_query_domain is not changed
154 - nm_query_domain is not changed
155 - cm_query_domain == nm_query_domain
156 - nm_query_domain.current.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom'
157 - nm_query_domain.current.0.vmmDomP.attributes.name == 'vmm_dom'
158
159 # REMOVE DOMAIN
160 - name: Remove VMM domain (check_mode)
161 cisco.aci.aci_domain: *domain_absent
162 check_mode: true
163 register: cm_remove_domain
164
165 - name: Remove VMM domain (normal mode)
166 cisco.aci.aci_domain: *domain_absent
167 register: nm_remove_domain
168
169 - name: Verify VMM remove_domain
170 ansible.builtin.assert:
171 that:
172 - cm_remove_domain is changed
173 - nm_remove_domain is changed
174 - cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous
175 - nm_remove_domain.previous.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom'
176 - nm_remove_domain.previous.0.vmmDomP.attributes.name == 'vmm_dom'
177 - nm_remove_domain.current == []
178
179 - name: Remove VMM domain again (check_mode)
180 cisco.aci.aci_domain: *domain_absent
181 check_mode: true
182 register: cm_remove_domain_again
183
184 - name: Remove VMM domain again (normal mode)
185 cisco.aci.aci_domain: *domain_absent
186 register: nm_remove_domain_again
187
188 - name: Verify VMM remove_domain_again
189 ansible.builtin.assert:
190 that:
191 - cm_remove_domain_again is not changed
192 - nm_remove_domain_again is not changed
193
194
195 # QUERY NON-EXISTING DOMAIN
196 - name: Query non-existing VMM domain (check_mode)
197 cisco.aci.aci_domain:
198 <<: *domain_query
199 domain: vmm_dom
200 vm_provider: vmware
201 check_mode: true
202 register: cm_query_non_domain
203
204 - name: Query non-existing VMM domain (normal mode)
205 cisco.aci.aci_domain:
206 <<: *domain_query
207 domain: vmm_dom
208 vm_provider: vmware
209 register: nm_query_non_domain
210
211 - name: Verify VMM query_non_domain
212 ansible.builtin.assert:
213 that:
214 - cm_query_non_domain is not changed
215 - nm_query_non_domain is not changed
216 - cm_query_non_domain == nm_query_non_domain
217 - nm_query_non_domain.current == []