6from __future__
import absolute_import, division, print_function
9ANSIBLE_METADATA = {
'metadata_version':
'1.1',
10 'status': [
'preview'],
11 'supported_by':
'certified'}
15module: aci_tenant_span_dst_group
16short_description: Manage SPAN destination groups (span:DestGrp)
18- Manage SPAN destination groups on Cisco ACI fabrics.
23 - The name of the SPAN destination group.
29 - The description of the SPAN destination group.
34 - The name of the tenant.
37 aliases: [ tenant_name ]
40 - Use C(present) or C(absent)
for adding
or removing.
41 - Use C(query)
for listing an object
or multiple objects.
43 choices: [ absent, present, query ]
45extends_documentation_fragment: aci
47- The C(tenant) used must exist before using this module
in your playbook.
48 The M(aci_tenant) module can be used
for this.
51- name: APIC Management Information Model reference
52 description: More information about the internal APIC
class B(span:DestGrp).
53 link: https://developer.cisco.com/docs/apic-mim-ref/
55- Dag Wieers (
@dagwieers)
58# FIXME: Add more, better examples
60- aci_tenant_span_dst_group:
63 password: SomeSecretPassword
64 dst_group: '{{ dst_group }}'
65 description:
'{{ descr }}'
66 tenant:
'{{ tenant }}'
67 delegate_to: localhost
72 description: The existing configuration from the APIC after the module has finished
80 "descr":
"Production environment",
81 "dn":
"uni/tn-production",
91 description: The error information
as returned
from the APIC
97 "text":
"unknown managed object class foo"
100 description: The raw output returned by the APIC REST API (xml
or json)
101 returned: parse error
103 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
105 description: The actual/minimal configuration pushed to the APIC
112 "descr":
"Production environment"
117 description: The original configuration
from the APIC before the module has started
125 "descr":
"Production",
126 "dn":
"uni/tn-production",
127 "name":
"production",
136 description: The assembled configuration
from the user-provided parameters
143 "descr":
"Production environment",
149 description: The filter string used
for the request
150 returned: failure
or debug
152 sample: ?rsp-prop-include=config-only
154 description: The HTTP method used
for the request to the APIC
155 returned: failure
or debug
159 description: The HTTP response
from the APIC
160 returned: failure
or debug
162 sample: OK (30 bytes)
164 description: The HTTP status
from the APIC
165 returned: failure
or debug
169 description: The HTTP url used
for the request to the APIC
170 returned: failure
or debug
172 sample: https://10.11.12.13/api/mo/uni/tn-production.json
175from ansible.module_utils.basic import AnsibleModule
176from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
181 argument_spec.update(
182 tenant=dict(type='str', aliases=[
'tenant_name']),
183 dst_group=dict(type=
'str', aliases=[
'name']),
184 description=dict(type=
'str', aliases=[
'descr']),
185 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
189 argument_spec=argument_spec,
190 supports_check_mode=
True,
192 [
'state',
'absent', [
'dst_group',
'tenant']],
193 [
'state',
'present', [
'dst_group',
'tenant']],
197 dst_group = module.params[
'dst_group']
198 description = module.params[
'description']
199 state = module.params[
'state']
200 tenant = module.params[
'tenant']
205 aci_class=
'fvTenant',
206 aci_rn=
'tn-{0}'.
format(tenant),
207 module_object=tenant,
208 target_filter={
'name': tenant},
211 aci_class=
'spanDestGrp',
212 aci_rn=
'destgrp-{0}'.
format(dst_group),
213 module_object=dst_group,
214 target_filter={
'name': dst_group},
220 if state ==
'present':
222 aci_class=
'spanDestGrp',
229 aci.get_diff(aci_class=
'spanDestGrp')
233 elif state ==
'absent':
239if __name__ ==
"__main__":