6from __future__
import absolute_import, division, print_function
9ANSIBLE_METADATA = {
'metadata_version':
'1.1',
10 'status': [
'preview'],
11 'supported_by':
'certified'}
15module: aci_interface_policy_mcp
16short_description: Manage MCP interface policies (mcp:IfPol)
18- Manage MCP interface policies on Cisco ACI fabrics.
23 - The name of the MCP interface.
26 aliases: [ mcp_interface, name ]
29 - The description for the MCP interface.
34 - Enable
or disable admin state.
35 - The APIC defaults to C(yes) when unset during creation.
39 - Use C(present)
or C(absent)
for adding
or removing.
40 - Use C(query)
for listing an object
or multiple objects.
42 choices: [ absent, present, query ]
44extends_documentation_fragment: aci
46- name: APIC Management Information Model reference
47 description: More information about the internal APIC
class B(mcp:IfPol).
48 link: https://developer.cisco.com/docs/apic-mim-ref/
50- Dag Wieers (
@dagwieers)
53# FIXME: Add more, better examples
55- aci_interface_policy_mcp:
56 host: '{{ hostname }}'
57 username:
'{{ username }}'
58 password:
'{{ password }}'
60 description:
'{{ descr }}'
61 admin_state:
'{{ admin_state }}'
62 delegate_to: localhost
67 description: The existing configuration from the APIC after the module has finished
75 "descr":
"Production environment",
76 "dn":
"uni/tn-production",
86 description: The error information
as returned
from the APIC
92 "text":
"unknown managed object class foo"
95 description: The raw output returned by the APIC REST API (xml
or json)
98 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
100 description: The actual/minimal configuration pushed to the APIC
107 "descr":
"Production environment"
112 description: The original configuration
from the APIC before the module has started
120 "descr":
"Production",
121 "dn":
"uni/tn-production",
122 "name":
"production",
131 description: The assembled configuration
from the user-provided parameters
138 "descr":
"Production environment",
144 description: The filter string used
for the request
145 returned: failure
or debug
147 sample: ?rsp-prop-include=config-only
149 description: The HTTP method used
for the request to the APIC
150 returned: failure
or debug
154 description: The HTTP response
from the APIC
155 returned: failure
or debug
157 sample: OK (30 bytes)
159 description: The HTTP status
from the APIC
160 returned: failure
or debug
164 description: The HTTP url used
for the request to the APIC
165 returned: failure
or debug
167 sample: https://10.11.12.13/api/mo/uni/tn-production.json
170from ansible.module_utils.basic import AnsibleModule
171from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
176 argument_spec.update(
177 mcp=dict(type='str', aliases=[
'mcp_interface',
'name']),
178 description=dict(type=
'str', aliases=[
'descr']),
179 admin_state=dict(type=
'bool'),
180 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
184 argument_spec=argument_spec,
185 supports_check_mode=
True,
187 [
'state',
'absent', [
'mcp']],
188 [
'state',
'present', [
'mcp']],
194 mcp = module.params[
'mcp']
195 description = module.params[
'description']
196 admin_state = aci.boolean(module.params[
'admin_state'],
'enabled',
'disabled')
197 state = module.params[
'state']
201 aci_class=
'mcpIfPol',
202 aci_rn=
'infra/mcpIfP-{0}'.
format(mcp),
204 target_filter={
'name': mcp},
210 if state ==
'present':
212 aci_class=
'mcpIfPol',
220 aci.get_diff(aci_class=
'mcpIfPol')
224 elif state ==
'absent':
230if __name__ ==
"__main__":