7from __future__
import absolute_import, division, print_function
10ANSIBLE_METADATA = {
'metadata_version':
'1.1',
11 'status': [
'preview'],
12 'supported_by':
'certified'}
16module: aci_switch_policy_leaf_profile
17short_description: Manage switch policy leaf profiles (infra:NodeP)
19- Manage switch policy leaf profiles on Cisco ACI fabrics.
24 - The name of the Leaf Profile.
26 aliases: [ leaf_profile_name, name ]
29 - Description for the Leaf Profile.
34 - Use C(present)
or C(absent)
for adding
or removing.
35 - Use C(query)
for listing an object
or multiple objects.
37 choices: [ absent, present, query ]
39extends_documentation_fragment: aci
41- module: aci_switch_policy_leaf_profile
42- name: APIC Management Information Model reference
43 description: More information about the internal APIC
class B(infra:NodeP).
44 link: https://developer.cisco.com/docs/apic-mim-ref/
46- Bruno Calogero (
@brunocalogero)
50- name: creating a Leaf Profile with description
51 aci_switch_policy_leaf_profile:
54 password: SomeSecretPassword
56 description: sw_description
58 delegate_to: localhost
60- name: Deleting a Leaf Profile
61 aci_switch_policy_leaf_profile:
64 password: SomeSecretPassword
67 delegate_to: localhost
69- name: Query a Leaf Profile
70 aci_switch_policy_leaf_profile:
73 password: SomeSecretPassword
76 delegate_to: localhost
77 register: query_result
82 description: The existing configuration from the APIC after the module has finished
90 "descr":
"Production environment",
91 "dn":
"uni/tn-production",
101 description: The error information
as returned
from the APIC
107 "text":
"unknown managed object class foo"
110 description: The raw output returned by the APIC REST API (xml
or json)
111 returned: parse error
113 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
115 description: The actual/minimal configuration pushed to the APIC
122 "descr":
"Production environment"
127 description: The original configuration
from the APIC before the module has started
135 "descr":
"Production",
136 "dn":
"uni/tn-production",
137 "name":
"production",
146 description: The assembled configuration
from the user-provided parameters
153 "descr":
"Production environment",
159 description: The filter string used
for the request
160 returned: failure
or debug
162 sample: ?rsp-prop-include=config-only
164 description: The HTTP method used
for the request to the APIC
165 returned: failure
or debug
169 description: The HTTP response
from the APIC
170 returned: failure
or debug
172 sample: OK (30 bytes)
174 description: The HTTP status
from the APIC
175 returned: failure
or debug
179 description: The HTTP url used
for the request to the APIC
180 returned: failure
or debug
182 sample: https://10.11.12.13/api/mo/uni/tn-production.json
185from ansible.module_utils.basic import AnsibleModule
186from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
191 argument_spec.update(
192 leaf_profile=dict(type='str', aliases=[
'name',
'leaf_profile_name']),
193 description=dict(type=
'str', aliases=[
'descr']),
194 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
198 argument_spec=argument_spec,
199 supports_check_mode=
True,
201 [
'state',
'absent', [
'leaf_profile']],
202 [
'state',
'present', [
'leaf_profile']],
206 leaf_profile = module.params[
'leaf_profile']
207 description = module.params[
'description']
208 state = module.params[
'state']
213 aci_class=
'infraNodeP',
214 aci_rn=
'infra/nprof-{0}'.
format(leaf_profile),
215 module_object=leaf_profile,
216 target_filter={
'name': leaf_profile},
222 if state ==
'present':
224 aci_class=
'infraNodeP',
231 aci.get_diff(aci_class=
'infraNodeP')
235 elif state ==
'absent':
241if __name__ ==
"__main__":