300
300
"""
301
301
302
302
from ansible .module_utils .basic import AnsibleModule
303
- from ansible_collections .cisco .aci .plugins .module_utils .aci import ACIModule , aci_argument_spec , enhanced_lag_spec , netflow_spec
304
- from ansible_collections .cisco .aci .plugins .module_utils .aci import aci_annotation_spec , aci_owner_spec
303
+ from ansible_collections .cisco .aci .plugins .module_utils .aci import (
304
+ ACIModule ,
305
+ aci_argument_spec ,
306
+ enhanced_lag_spec ,
307
+ netflow_spec ,
308
+ aci_annotation_spec ,
309
+ aci_owner_spec ,
310
+ )
311
+ from ansible_collections .cisco .aci .plugins .module_utils .constants import (
312
+ VM_PROVIDER_MAPPING ,
313
+ )
305
314
306
315
# via UI vSwitch Policy can only be added for VMware and Microsoft vmm domains
307
316
# behavior for other domains is currently untested.
308
- VM_PROVIDER_MAPPING = dict (
309
- cloudfoundry = "CloudFoundry" ,
310
- kubernetes = "Kubernetes" ,
311
- microsoft = "Microsoft" ,
312
- openshift = "OpenShift" ,
313
- openstack = "OpenStack" ,
314
- redhat = "Redhat" ,
315
- vmware = "VMware" ,
316
- )
317
317
318
318
# enhanced_lag_spec = dict(
319
319
# name=dict(type='str', required=True),
326
326
# 'src-dst-l4port', 'src-port-id', 'vlan']),
327
327
# number_uplinks=dict(type='int'),
328
328
# )
329
-
330
329
# netflow_spec = dict(
331
330
# name=dict(type='str', required=True),
332
331
# active_flow_timeout=dict(type='int'),
336
335
337
336
338
337
def main ():
338
+
339
+ # Remove nutanix from VM_PROVIDER_MAPPING as it is not supported
340
+ CLEAN_VM_PROVIDER_MAPPING = VM_PROVIDER_MAPPING .copy ()
341
+ CLEAN_VM_PROVIDER_MAPPING .pop ("nutanix" )
342
+
339
343
argument_spec = aci_argument_spec ()
340
344
argument_spec .update (aci_annotation_spec ())
341
345
argument_spec .update (aci_owner_spec ())
@@ -349,7 +353,7 @@ def main():
349
353
netflow_exporter = dict (type = "dict" , options = netflow_spec ()),
350
354
domain = dict (type = "str" , aliases = ["domain_name" , "domain_profile" ]),
351
355
state = dict (type = "str" , default = "present" , choices = ["absent" , "present" , "query" ]),
352
- vm_provider = dict (type = "str" , choices = list (VM_PROVIDER_MAPPING . keys ()) ),
356
+ vm_provider = dict (type = "str" , choices = list (CLEAN_VM_PROVIDER_MAPPING ),
353
357
)
354
358
355
359
module = AnsibleModule (
@@ -388,7 +392,7 @@ def main():
388
392
aci .construct_url (
389
393
root_class = dict (
390
394
aci_class = "vmmProvP" ,
391
- aci_rn = "vmmp-{0}" .format (VM_PROVIDER_MAPPING .get (vm_provider )),
395
+ aci_rn = "vmmp-{0}" .format (CLEAN_VM_PROVIDER_MAPPING .get (vm_provider )),
392
396
module_object = vm_provider ,
393
397
target_filter = {"name" : vm_provider },
394
398
),
0 commit comments