6from __future__
import absolute_import, division, print_function
9ANSIBLE_METADATA = {
'metadata_version':
'1.1',
10 'status': [
'preview'],
11 'supported_by':
'certified'}
15module: aci_bd_to_l3out
16short_description: Bind Bridge Domain to L3 Out (fv:RsBDToOut)
18- Bind Bridge Domain to L3 Out on Cisco ACI fabrics.
23 - The name of the Bridge Domain.
25 aliases: [ bd_name, bridge_domain ]
28 - The name of the l3out to associate with th Bridge Domain.
32 - The name of the Tenant.
34 aliases: [ tenant_name ]
37 - Use C(present)
or C(absent)
for adding
or removing.
38 - Use C(query)
for listing an object
or multiple objects.
40 choices: [ absent, present, query ]
42extends_documentation_fragment: aci
44- The C(bd)
and C(l3out) parameters should exist before using this module.
45 The M(aci_bd)
and C(aci_l3out) can be used
for these.
49- name: APIC Management Information Model reference
50 description: More information about the internal APIC
class B(fv:RsBDToOut).
51 link: https://developer.cisco.com/docs/apic-mim-ref/
53- Jacob McGill (
@jmcgill298)
60 description: The existing configuration from the APIC after the module has finished
68 "descr":
"Production environment",
69 "dn":
"uni/tn-production",
79 description: The error information
as returned
from the APIC
85 "text":
"unknown managed object class foo"
88 description: The raw output returned by the APIC REST API (xml
or json)
91 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
93 description: The actual/minimal configuration pushed to the APIC
100 "descr":
"Production environment"
105 description: The original configuration
from the APIC before the module has started
113 "descr":
"Production",
114 "dn":
"uni/tn-production",
115 "name":
"production",
124 description: The assembled configuration
from the user-provided parameters
131 "descr":
"Production environment",
137 description: The filter string used
for the request
138 returned: failure
or debug
140 sample: ?rsp-prop-include=config-only
142 description: The HTTP method used
for the request to the APIC
143 returned: failure
or debug
147 description: The HTTP response
from the APIC
148 returned: failure
or debug
150 sample: OK (30 bytes)
152 description: The HTTP status
from the APIC
153 returned: failure
or debug
157 description: The HTTP url used
for the request to the APIC
158 returned: failure
or debug
160 sample: https://10.11.12.13/api/mo/uni/tn-production.json
163from ansible.module_utils.basic import AnsibleModule
164from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
166SUBNET_CONTROL_MAPPING = dict(
168 no_gw=
'no-default-gateway',
169 querier_ip=
'querier',
176 argument_spec.update(
177 bd=dict(type=
'str', aliases=[
'bd_name',
'bridge_domain']),
178 l3out=dict(type=
'str'),
179 tenant=dict(type=
'str', aliases=[
'tenant_name']),
180 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
184 argument_spec=argument_spec,
185 supports_check_mode=
True,
186 required_together=[[
'gateway',
'mask']],
188 [
'state',
'present', [
'bd',
'l3out',
'tenant']],
189 [
'state',
'absent', [
'bd',
'l3out',
'tenant']],
193 bd = module.params[
'bd']
194 l3out = module.params[
'l3out']
195 state = module.params[
'state']
196 tenant = module.params[
'tenant']
201 aci_class=
'fvTenant',
202 aci_rn=
'tn-{0}'.
format(tenant),
203 module_object=tenant,
204 target_filter={
'name': tenant},
208 aci_rn=
'BD-{0}'.
format(bd),
210 target_filter={
'name': bd},
213 aci_class=
'fvRsBDToOut',
214 aci_rn=
'rsBDToOut-{0}'.
format(l3out),
216 target_filter={
'tnL3extOutName': l3out},
222 if state ==
'present':
224 aci_class=
'fvRsBDToOut',
225 class_config=dict(tnL3extOutName=l3out),
228 aci.get_diff(aci_class=
'fvRsBDToOut')
232 elif state ==
'absent':
238if __name__ ==
"__main__":