7from __future__
import absolute_import, division, print_function
10ANSIBLE_METADATA = {
'metadata_version':
'1.1',
11 'status': [
'preview'],
12 'supported_by':
'certified'}
16module: aci_interface_policy_leaf_profile
17short_description: Manage fabric interface policy leaf profiles (infra:AccPortP)
19- Manage fabric interface policy leaf profiles on Cisco ACI fabrics.
22 leaf_interface_profile:
24 - The name of the Fabric access policy leaf interface profile.
27 aliases: [ name, leaf_interface_profile_name ]
30 - Description for the Fabric access policy leaf interface profile.
35 - Use C(present)
or C(absent)
for adding
or removing.
36 - Use C(query)
for listing an object
or multiple objects.
38 choices: [ absent, present, query ]
40extends_documentation_fragment: aci
42- name: APIC Management Information Model reference
43 description: More information about the internal APIC
class B(infra:AccPortP).
44 link: https://developer.cisco.com/docs/apic-mim-ref/
46- Bruno Calogero (
@brunocalogero)
50- name: Add a new leaf_interface_profile
51 aci_interface_policy_leaf_profile:
54 password: SomeSecretPassword
55 leaf_interface_profile: leafintprfname
56 description: leafintprfname description
58 delegate_to: localhost
60- name: Remove a leaf_interface_profile
61 aci_interface_policy_leaf_profile:
64 password: SomeSecretPassword
65 leaf_interface_profile: leafintprfname
67 delegate_to: localhost
69- name: Remove all leaf_interface_profiles
70 aci_interface_policy_leaf_profile:
73 password: SomeSecretPassword
75 delegate_to: localhost
77- name: Query a leaf_interface_profile
78 aci_interface_policy_leaf_profile:
81 password: SomeSecretPassword
82 leaf_interface_profile: leafintprfname
84 delegate_to: localhost
85 register: query_result
90 description: The existing configuration from the APIC after the module has finished
98 "descr":
"Production environment",
99 "dn":
"uni/tn-production",
100 "name":
"production",
109 description: The error information
as returned
from the APIC
115 "text":
"unknown managed object class foo"
118 description: The raw output returned by the APIC REST API (xml
or json)
119 returned: parse error
121 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
123 description: The actual/minimal configuration pushed to the APIC
130 "descr":
"Production environment"
135 description: The original configuration
from the APIC before the module has started
143 "descr":
"Production",
144 "dn":
"uni/tn-production",
145 "name":
"production",
154 description: The assembled configuration
from the user-provided parameters
161 "descr":
"Production environment",
167 description: The filter string used
for the request
168 returned: failure
or debug
170 sample: ?rsp-prop-include=config-only
172 description: The HTTP method used
for the request to the APIC
173 returned: failure
or debug
177 description: The HTTP response
from the APIC
178 returned: failure
or debug
180 sample: OK (30 bytes)
182 description: The HTTP status
from the APIC
183 returned: failure
or debug
187 description: The HTTP url used
for the request to the APIC
188 returned: failure
or debug
190 sample: https://10.11.12.13/api/mo/uni/tn-production.json
193from ansible.module_utils.basic import AnsibleModule
194from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
199 argument_spec.update(
200 leaf_interface_profile=dict(type='str', aliases=[
'name',
'leaf_interface_profile_name']),
201 description=dict(type=
'str', aliases=[
'descr']),
202 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
206 argument_spec=argument_spec,
207 supports_check_mode=
True,
209 [
'state',
'absent', [
'leaf_interface_profile']],
210 [
'state',
'present', [
'leaf_interface_profile']],
214 leaf_interface_profile = module.params[
'leaf_interface_profile']
215 description = module.params[
'description']
216 state = module.params[
'state']
221 aci_class=
'infraAccPortP',
222 aci_rn=
'infra/accportprof-{0}'.
format(leaf_interface_profile),
223 module_object=leaf_interface_profile,
224 target_filter={
'name': leaf_interface_profile},
229 if state ==
'present':
231 aci_class=
'infraAccPortP',
233 name=leaf_interface_profile,
238 aci.get_diff(aci_class=
'infraAccPortP')
242 elif state ==
'absent':
248if __name__ ==
"__main__":