5from __future__
import absolute_import, division, print_function
10 'metadata_version':
'1.1',
11 'status': [
'preview'],
12 'supported_by':
'community'
17module: aci_firmware_group_node
19short_description: This modules adds and remove nodes from the firmware group
24 - This module addes/deletes a node to the firmware group. This modules assigns 1 node at a time.
29 - This is the name of the firmware group
33 - The node to be added to the firmware group - the value equals the NodeID
37 - Use C(present)
or C(absent)
for adding
or removing.
38 - Use C(query)
for listing an object
or multiple objects.
40 choices: [ absent, present, query ]
42extends_documentation_fragment:
46 - Steven Gerhart (
@sgerhart)
50 - name: add firmware group node
51 aci_firmware_group_node:
52 host:
"{{ inventory_hostname }}"
53 username:
"{{ user }}"
54 password:
"{{ pass }}"
59 - name: Remove firmware group node
60 aci_firmware_group_node:
61 host:
"{{ inventory_hostname }}"
62 username:
"{{ user }}"
63 password:
"{{ pass }}"
72 description: The existing configuration
from the APIC after the module has finished
80 "descr":
"Production environment",
81 "dn":
"uni/tn-production",
91 description: The error information
as returned
from the APIC
97 "text":
"unknown managed object class foo"
100 description: The raw output returned by the APIC REST API (xml
or json)
101 returned: parse error
103 sample:
'<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
105 description: The actual/minimal configuration pushed to the APIC
112 "descr":
"Production environment"
117 description: The original configuration
from the APIC before the module has started
125 "descr":
"Production",
126 "dn":
"uni/tn-production",
127 "name":
"production",
136 description: The assembled configuration
from the user-provided parameters
143 "descr":
"Production environment",
149 description: The filter string used
for the request
150 returned: failure
or debug
152 sample: ?rsp-prop-include=config-only
154 description: The HTTP method used
for the request to the APIC
155 returned: failure
or debug
159 description: The HTTP response
from the APIC
160 returned: failure
or debug
162 sample: OK (30 bytes)
164 description: The HTTP status
from the APIC
165 returned: failure
or debug
169 description: The HTTP url used
for the request to the APIC
170 returned: failure
or debug
172 sample: https://10.11.12.13/api/mo/uni/tn-production.json
176from ansible.module_utils.network.aci.aci import ACIModule, aci_argument_spec
177from ansible.module_utils.basic import AnsibleModule
182 argument_spec.update(
183 group=dict(type='str', aliases=[
'group']),
184 node=dict(type=
'str', aliases=[
'node']),
185 state=dict(type=
'str', default=
'present', choices=[
'absent',
'present',
'query']),
189 argument_spec=argument_spec,
190 supports_check_mode=
True,
192 [
'state',
'absent', [
'node',
'group']],
193 [
'state',
'present', [
'node',
'group']],
197 state = module.params[
'state']
198 group = module.params[
'group']
199 node = module.params[
'node']
204 aci_class=
'firmwareFwGrp',
205 aci_rn=
'fabric/fwgrp-{0}'.
format(group),
206 target_filter={
'name': group},
210 aci_class=
'fabricNodeBlk',
211 aci_rn=
'nodeblk-blk{0}-{0}'.
format(node),
212 target_filter={
'name': node},
220 if state ==
'present':
222 aci_class=
'fabricNodeBlk',
231 aci.get_diff(aci_class=
'fabricNodeBlk')
235 elif state ==
'absent':
241if __name__ ==
"__main__":