6from __future__
import absolute_import, division, print_function
9ANSIBLE_METADATA = {
'metadata_version':
'1.1',
10 'status': [
'preview'],
11 'supported_by':
'certified'}
15module: aci_l3out_extepg
16short_description: Manage External Network Instance Profile (ExtEpg) objects (l3extInstP:instP)
18- Manage External Network Instance Profile (ExtEpg) objects (l3extInstP:instP)
23 - Name of an existing tenant.
26 aliases: [ tenant_name ]
29 - Name of an existing L3Out.
32 aliases: [ l3out_name ]
35 - Name of ExtEpg being created.
38 aliases: [ extepg_name, name ]
41 - Description for the ExtEpg.
46 - Whether ot
not the EPG
is part of the Preferred Group
and can communicate without contracts.
47 - This
is very convenient
for migration scenarios,
or when ACI
is used
for network automation but
not for policy.
48 - The APIC defaults to C(no) when unset during creation.
52 - The target Differentiated Service (DSCP) value.
53 - The APIC defaults to C(unspecified) when unset during creation.
55 choices: [ AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43, CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, EF, VA, unspecified ]
59 - Use C(present)
or C(absent)
for adding
or removing.
60 - Use C(query)
for listing an object
or multiple objects.
62 choices: [ absent, present, query ]
64extends_documentation_fragment: aci
66- The C(tenant)
and C(domain)
and C(vrf) used must exist before using this module
in your playbook.
67 The M(aci_tenant)
and M(aci_domain)
and M(aci_vrf) modules can be used
for this.
72- name: APIC Management Information Model reference
73 description: More information about the internal APIC
class B(l3ext:Out).
74 link: https://developer.cisco.com/docs/apic-mim-ref/
76- Rostyslav Davydenko (
@rost-d)
80- name: Add a new ExtEpg
84 password: SomeSecretPassword
88 description: ExtEpg for Production L3Out
90 delegate_to: localhost
96 password: SomeSecretPassword
101 delegate_to: localhost
103- name: Query ExtEpg information
107 password: SomeSecretPassword
112 delegate_to: localhost
113 register: query_result
118 description: The existing configuration from the APIC after the module has finished
126 "descr":
"Production environment",
127 "dn":
"uni/tn-production",
128 "name":
"production",
137 description: The error information
as returned
from the APIC
143 "text":
"unknown managed object class foo"
146 description: The raw output returned by the APIC REST API (xml
or json)
147 returned: parse error
149 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
151 description: The actual/minimal configuration pushed to the APIC
158 "descr":
"Production environment"
163 description: The original configuration
from the APIC before the module has started
171 "descr":
"Production",
172 "dn":
"uni/tn-production",
173 "name":
"production",
182 description: The assembled configuration
from the user-provided parameters
189 "descr":
"Production environment",
195 description: The filter string used
for the request
196 returned: failure
or debug
198 sample: ?rsp-prop-include=config-only
200 description: The HTTP method used
for the request to the APIC
201 returned: failure
or debug
205 description: The HTTP response
from the APIC
206 returned: failure
or debug
208 sample: OK (30 bytes)
210 description: The HTTP status
from the APIC
211 returned: failure
or debug
215 description: The HTTP url used
for the request to the APIC
216 returned: failure
or debug
218 sample: https://10.11.12.13/api/mo/uni/tn-production.json
221from ansible.module_utils.basic import AnsibleModule
222from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
227 argument_spec.update(
228 tenant=dict(type='str', aliases=[
'tenant_name']),
229 l3out=dict(type=
'str', aliases=[
'l3out_name']),
230 extepg=dict(type=
'str', aliases=[
'extepg_name',
'name']),
231 description=dict(type=
'str', aliases=[
'descr']),
232 preferred_group=dict(type=
'bool'),
233 dscp=dict(type=
'str',
234 choices=[
'AF11',
'AF12',
'AF13',
'AF21',
'AF22',
'AF23',
'AF31',
'AF32',
'AF33',
'AF41',
'AF42',
235 'AF43',
'CS0',
'CS1',
'CS2',
'CS3',
'CS4',
'CS5',
'CS6',
'CS7',
'EF',
'VA',
'unspecified'],
237 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query'])
241 argument_spec=argument_spec,
242 supports_check_mode=
True,
244 [
'state',
'present', [
'extepg',
'l3out',
'tenant']],
245 [
'state',
'absent', [
'extepg',
'l3out',
'tenant']],
251 tenant = module.params[
'tenant']
252 l3out = module.params[
'l3out']
253 extepg = module.params[
'extepg']
254 description = module.params[
'description']
255 preferred_group = aci.boolean(module.params[
'preferred_group'],
'include',
'exclude')
256 dscp = module.params[
'dscp']
257 state = module.params[
'state']
261 aci_class=
'fvTenant',
262 aci_rn=
'tn-{0}'.
format(tenant),
263 module_object=tenant,
264 target_filter={
'name': tenant},
267 aci_class=
'l3extOut',
268 aci_rn=
'out-{0}'.
format(l3out),
270 target_filter={
'name': l3out},
273 aci_class=
'l3extInstP',
274 aci_rn=
'instP-{0}'.
format(extepg),
275 module_object=extepg,
276 target_filter={
'name': extepg},
282 if state ==
'present':
284 aci_class=
'l3extInstP',
288 prefGrMemb=preferred_group,
293 aci.get_diff(aci_class=
'l3extInstP')
297 elif state ==
'absent':
303if __name__ ==
"__main__":