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_lldp
16short_description: Manage LLDP interface policies (lldp:IfPol)
18- Manage LLDP interface policies on Cisco ACI fabrics.
23 - The LLDP interface policy name.
29 - The description for the LLDP interface policy name.
34 - Enable
or disable Receive state.
35 - The APIC defaults to C(yes) when unset during creation.
39 - Enable
or Disable Transmit state.
40 - The APIC defaults to C(yes) when unset during creation.
44 - Use C(present)
or C(absent)
for adding
or removing.
45 - Use C(query)
for listing an object
or multiple objects.
47 choices: [ absent, present, query ]
49extends_documentation_fragment: aci
51- name: APIC Management Information Model reference
52 description: More information about the internal APIC
class B(lldp:IfPol).
53 link: https://developer.cisco.com/docs/apic-mim-ref/
55- Dag Wieers (
@dagwieers)
58# FIXME: Add more, better examples
60- aci_interface_policy_lldp:
61 host: '{{ hostname }}'
62 username:
'{{ username }}'
63 password:
'{{ password }}'
64 lldp_policy:
'{{ lldp_policy }}'
65 description:
'{{ description }}'
66 receive_state:
'{{ receive_state }}'
67 transmit_state:
'{{ transmit_state }}'
68 delegate_to: localhost
73 description: The existing configuration from the APIC after the module has finished
81 "descr":
"Production environment",
82 "dn":
"uni/tn-production",
92 description: The error information
as returned
from the APIC
98 "text":
"unknown managed object class foo"
101 description: The raw output returned by the APIC REST API (xml
or json)
102 returned: parse error
104 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
106 description: The actual/minimal configuration pushed to the APIC
113 "descr":
"Production environment"
118 description: The original configuration
from the APIC before the module has started
126 "descr":
"Production",
127 "dn":
"uni/tn-production",
128 "name":
"production",
137 description: The assembled configuration
from the user-provided parameters
144 "descr":
"Production environment",
150 description: The filter string used
for the request
151 returned: failure
or debug
153 sample: ?rsp-prop-include=config-only
155 description: The HTTP method used
for the request to the APIC
156 returned: failure
or debug
160 description: The HTTP response
from the APIC
161 returned: failure
or debug
163 sample: OK (30 bytes)
165 description: The HTTP status
from the APIC
166 returned: failure
or debug
170 description: The HTTP url used
for the request to the APIC
171 returned: failure
or debug
173 sample: https://10.11.12.13/api/mo/uni/tn-production.json
176from ansible.module_utils.basic import AnsibleModule
177from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
182 argument_spec.update(
183 lldp_policy=dict(type='str', aliases=[
'name']),
184 description=dict(type=
'str', aliases=[
'descr']),
185 receive_state=dict(type=
'bool'),
186 transmit_state=dict(type=
'bool'),
187 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
191 argument_spec=argument_spec,
192 supports_check_mode=
True,
194 [
'state',
'absent', [
'lldp_policy']],
195 [
'state',
'present', [
'lldp_policy']],
201 lldp_policy = module.params[
'lldp_policy']
202 description = module.params[
'description']
203 receive_state = aci.boolean(module.params[
'receive_state'],
'enabled',
'disabled')
204 transmit_state = aci.boolean(module.params[
'transmit_state'],
'enabled',
'disabled')
205 state = module.params[
'state']
209 aci_class=
'lldpIfPol',
210 aci_rn=
'infra/lldpIfP-{0}'.
format(lldp_policy),
211 module_object=lldp_policy,
212 target_filter={
'name': lldp_policy},
218 if state ==
'present':
220 aci_class=
'lldpIfPol',
224 adminRxSt=receive_state,
225 adminTxSt=transmit_state,
229 aci.get_diff(aci_class=
'lldpIfPol')
233 elif state ==
'absent':
239if __name__ ==
"__main__":