6from __future__
import absolute_import, division, print_function
9ANSIBLE_METADATA = {
'metadata_version':
'1.1',
10 'status': [
'preview'],
11 'supported_by':
'certified'}
16short_description: Manage attachable Access Entity Profile (AEP) objects (infra:AttEntityP, infra:ProvAcc)
18- Connect to external virtual and physical domains by using
19 attachable Access Entity Profiles (AEP) on Cisco ACI fabrics.
24 - The name of the Attachable Access Entity Profile.
27 aliases: [ aep_name, name ]
30 - Description
for the AEP.
35 - Enable infrastructure VLAN.
36 - The hypervisor functions of the AEP.
37 - C(no) will disable the infrastructure vlan
if it
is enabled.
39 aliases: [ infrastructure_vlan ]
43 - Use C(present)
or C(absent)
for adding
or removing.
44 - Use C(query)
for listing an object
or multiple objects.
47 choices: [ absent, present, query ]
48extends_documentation_fragment: aci
50- module: aci_aep_to_domain
51- name: APIC Management Information Model reference
52 description: More information about the internal APIC classes B(infra:AttEntityP)
and B(infra:ProvAcc).
53 link: https://developer.cisco.com/docs/apic-mim-ref/
55- Swetha Chunduri (
@schunduri)
63 password: SomeSecretPassword
67 delegate_to: localhost
69- name: Remove an existing AEP
73 password: SomeSecretPassword
76 delegate_to: localhost
82 password: SomeSecretPassword
84 delegate_to: localhost
85 register: query_result
87- name: Query a specific AEP
91 password: SomeSecretPassword
94 delegate_to: localhost
95 register: query_result
100 description: The existing configuration from the APIC after the module has finished
108 "descr":
"Production environment",
109 "dn":
"uni/tn-production",
110 "name":
"production",
119 description: The error information
as returned
from the APIC
125 "text":
"unknown managed object class foo"
128 description: The raw output returned by the APIC REST API (xml
or json)
129 returned: parse error
131 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
133 description: The actual/minimal configuration pushed to the APIC
140 "descr":
"Production environment"
145 description: The original configuration
from the APIC before the module has started
153 "descr":
"Production",
154 "dn":
"uni/tn-production",
155 "name":
"production",
164 description: The assembled configuration
from the user-provided parameters
171 "descr":
"Production environment",
177 description: The filter string used
for the request
178 returned: failure
or debug
180 sample: ?rsp-prop-include=config-only
182 description: The HTTP method used
for the request to the APIC
183 returned: failure
or debug
187 description: The HTTP response
from the APIC
188 returned: failure
or debug
190 sample: OK (30 bytes)
192 description: The HTTP status
from the APIC
193 returned: failure
or debug
197 description: The HTTP url used
for the request to the APIC
198 returned: failure
or debug
200 sample: https://10.11.12.13/api/mo/uni/tn-production.json
203from ansible.module_utils.basic import AnsibleModule
204from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
209 argument_spec.update(
210 aep=dict(type='str', aliases=[
'name',
'aep_name']),
211 description=dict(type=
'str', aliases=[
'descr']),
212 infra_vlan=dict(type=
'bool', aliases=[
'infrastructure_vlan']),
213 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
217 argument_spec=argument_spec,
218 supports_check_mode=
True,
220 [
'state',
'absent', [
'aep']],
221 [
'state',
'present', [
'aep']],
225 aep = module.params[
'aep']
226 description = module.params[
'description']
227 infra_vlan = module.params[
'infra_vlan']
228 state = module.params[
'state']
231 child_configs = [dict(infraProvAcc=dict(attributes=dict(name=
'provacc')))]
232 elif infra_vlan
is False:
233 child_configs = [dict(infraProvAcc=dict(attributes=dict(name=
'provacc', status=
'deleted')))]
240 aci_class=
'infraAttEntityP',
241 aci_rn=
'infra/attentp-{0}'.
format(aep),
243 target_filter={
'name': aep},
248 if state ==
'present':
250 aci_class=
'infraAttEntityP',
255 child_configs=child_configs,
258 aci.get_diff(aci_class=
'infraAttEntityP')
262 elif state ==
'absent':
268if __name__ ==
"__main__":