6from __future__
import absolute_import, division, print_function
10 'metadata_version':
'1.1',
11 'status': [
'preview'],
12 'supported_by':
'community'
16module: aci_maintenance_group
17short_description: This creates an ACI maintenance group
20 - a maintenance policy (aci_maintenance_policy must be created prior to creating an aci maintenance group
22 - This modules creates an ACI maintenance group
26 - This is the name of the group
30 - This
is the name of the policy that was created using aci_maintenance_policy
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']
38extends_documentation_fragment:
41 - Steven Gerhart (
@sgerhart)
45- name: maintenance group
46 aci_maintenance_group:
47 host:
"{{ inventory_hostname }}"
48 username:
"{{ user }}"
49 password:
"{{ pass }}"
51 group: maintenancegrp1
52 policy: maintenancePol1
58 description: The existing configuration
from the APIC after the module has finished
66 "descr":
"Production environment",
67 "dn":
"uni/tn-production",
77 description: The error information
as returned
from the APIC
83 "text":
"unknown managed object class foo"
86 description: The raw output returned by the APIC REST API (xml
or json)
89 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
91 description: The actual/minimal configuration pushed to the APIC
98 "descr":
"Production environment"
103 description: The original configuration
from the APIC before the module has started
111 "descr":
"Production",
112 "dn":
"uni/tn-production",
113 "name":
"production",
122 description: The assembled configuration
from the user-provided parameters
129 "descr":
"Production environment",
135 description: The filter string used
for the request
136 returned: failure
or debug
138 sample: ?rsp-prop-include=config-only
140 description: The HTTP method used
for the request to the APIC
141 returned: failure
or debug
145 description: The HTTP response
from the APIC
146 returned: failure
or debug
148 sample: OK (30 bytes)
150 description: The HTTP status
from the APIC
151 returned: failure
or debug
155 description: The HTTP url used
for the request to the APIC
156 returned: failure
or debug
158 sample: https://10.11.12.13/api/mo/uni/tn-production.json
161from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
162from ansible.module_utils.basic import AnsibleModule
167 argument_spec.update(
168 group=dict(type='str'),
169 policy=dict(type=
'str'),
170 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
174 argument_spec=argument_spec,
175 supports_check_mode=
True,
177 [
'state',
'absent', [
'group']],
178 [
'state',
'present', [
'group']],
182 state = module.params[
'state']
183 group = module.params[
'group']
184 policy = module.params[
'policy']
189 aci_class=
'maintMaintGrp',
190 aci_rn=
'fabric/maintgrp-{0}'.
format(group),
191 target_filter={
'name': group},
194 child_classes=[
'maintRsMgrpp'],
199 if state ==
'present':
201 aci_class=
'maintMaintGrp',
209 tnMaintMaintPName=policy,
217 aci.get_diff(aci_class=
'maintMaintGrp')
221 elif state ==
'absent':
227if __name__ ==
"__main__":