Debian Codegraph @

ansible_collections/dellemc/openmanage/docs/modules/ome_template.rst

raw
1 .. _ome_template_module:
2
3
4 ome_template -- Create, modify, deploy, delete, export, import and clone a template on OpenManage Enterprise
5 ============================================================================================================
6
7 .. contents::
8 :local:
9 :depth: 1
10
11
12 Synopsis
13 --------
14
15 This module creates, modifies, deploys, deletes, exports, imports and clones a template on OpenManage Enterprise.
16
17
18
19 Requirements
20 ------------
21 The below requirements are needed on the host that executes this module.
22
23 - python \>= 3.9.6
24
25
26
27 Parameters
28 ----------
29
30 command (optional, str, create)
31 \ :literal:`create`\ creates a new template.
32
33 \ :literal:`modify`\ modifies an existing template.
34
35 \ :literal:`deploy`\ creates a template-deployment job.
36
37 \ :literal:`delete`\ deletes an existing template.
38
39 \ :literal:`export`\ exports an existing template.
40
41 \ :literal:`import`\ creates a template from a specified configuration text in SCP XML format.
42
43 \ :literal:`clone`\ creates a clone of a existing template.
44
45
46 template_id (optional, int, None)
47 ID of the existing template.
48
49 This option is applicable when \ :emphasis:`command`\ is \ :literal:`modify`\ , \ :literal:`deploy`\ , \ :literal:`delete`\ , \ :literal:`clone`\ and \ :literal:`export`\ .
50
51 This option is mutually exclusive with \ :emphasis:`template\_name`\ .
52
53
54 template_name (optional, str, None)
55 Name of the existing template.
56
57 This option is applicable when \ :emphasis:`command`\ is \ :literal:`modify`\ , \ :literal:`deploy`\ , \ :literal:`delete`\ , \ :literal:`clone`\ and \ :literal:`export`\ .
58
59 This option is mutually exclusive with \ :emphasis:`template\_id`\ .
60
61
62 device_id (optional, list, [])
63 Specify the list of targeted device ID(s) when \ :emphasis:`command`\ is \ :literal:`deploy`\ . When I (command) is \ :literal:`create`\ , specify the ID of a single device.
64
65 Either \ :emphasis:`device\_id`\ or \ :emphasis:`device\_service\_tag`\ is mandatory or both can be applicable.
66
67
68 device_service_tag (optional, list, [])
69 Specify the list of targeted device service tags when I (command) is \ :literal:`deploy`\ . When \ :emphasis:`command`\ is \ :literal:`create`\ , specify the service tag of a single device.
70
71 Either \ :emphasis:`device\_id`\ or \ :emphasis:`device\_service\_tag`\ is mandatory or both can be applicable.
72
73
74 device_group_names (optional, list, [])
75 Specify the list of groups when I (command) is \ :literal:`deploy`\ .
76
77 Provide at least one of the mandatory options \ :emphasis:`device\_id`\ , \ :emphasis:`device\_service\_tag`\ , or \ :emphasis:`device\_group\_names`\ .
78
79
80 template_view_type (optional, str, Deployment)
81 Select the type of view of the OME template.
82
83 This is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ ,\ :literal:`clone`\ and \ :literal:`import`\ .
84
85
86 attributes (optional, dict, None)
87 Payload data for the template operations. All the variables in this option are added as payload for \ :literal:`create`\ , \ :literal:`modify`\ , \ :literal:`deploy`\ , \ :literal:`import`\ , and \ :literal:`clone`\ operations. It takes the following attributes.
88
89 Attributes: List of dictionaries of attributes (if any) to be modified in the deployment template. This is applicable when \ :emphasis:`command`\ is \ :literal:`deploy`\ and \ :literal:`modify`\ . Use the \ :emphasis:`Id`\ If the attribute Id is available. If not, use the comma separated I (DisplayName). For more details about using the \ :emphasis:`DisplayName`\ , see the example provided.
90
91 Name: Name of the template. This is mandatory when \ :emphasis:`command`\ is \ :literal:`create`\ , \ :literal:`import`\ , \ :literal:`clone`\ , and optional when \ :emphasis:`command`\ is \ :literal:`modify`\ .
92
93 Description: Description for the template. This is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ or \ :literal:`modify`\ .
94
95 Fqdds: This allows to create a template using components from a specified reference server. One or more, of the following values must be specified in a comma-separated string: iDRAC, System, BIOS, NIC, LifeCycleController, RAID, and EventFilters. If none of the values are specified, the default value 'All' is selected. This is applicable when I (command) is \ :literal:`create`\ .
96
97 Options: Options to control device shutdown or end power state post template deployment. This is applicable for \ :literal:`deploy`\ operation.
98
99 Schedule: Provides options to schedule the deployment task immediately, or at a specified time. This is applicable when \ :emphasis:`command`\ is \ :literal:`deploy`\ .
100
101 NetworkBootIsoModel: Payload to specify the ISO deployment details. This is applicable when \ :emphasis:`command`\ is \ :literal:`deploy`\ .
102
103 Content: The XML content of template. This is applicable when \ :emphasis:`command`\ is \ :literal:`import`\ .
104
105 Type: Template type ID, indicating the type of device for which configuration is supported, such as chassis and servers. This is applicable when \ :emphasis:`command`\ is \ :literal:`import`\ .
106
107 TypeId: Template type ID, indicating the type of device for which configuration is supported, such as chassis and servers. This is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ .
108
109 Refer OpenManage Enterprise API Reference Guide for more details.
110
111
112 job_wait (optional, bool, True)
113 Provides the option to wait for job completion.
114
115 This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , or \ :literal:`deploy`\ .
116
117
118 job_wait_timeout (optional, int, 1200)
119 The maximum wait time of \ :emphasis:`job\_wait`\ in seconds. The job is tracked only for this duration.
120
121 This option is applicable when \ :emphasis:`job\_wait`\ is \ :literal:`true`\ .
122
123
124 hostname (True, str, None)
125 OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname.
126
127
128 username (False, str, None)
129 OpenManage Enterprise or OpenManage Enterprise Modular username.
130
131 If the username is not provided, then the environment variable \ :envvar:`OME\_USERNAME`\ is used.
132
133 Example: export OME\_USERNAME=username
134
135
136 password (False, str, None)
137 OpenManage Enterprise or OpenManage Enterprise Modular password.
138
139 If the password is not provided, then the environment variable \ :envvar:`OME\_PASSWORD`\ is used.
140
141 Example: export OME\_PASSWORD=password
142
143
144 x_auth_token (False, str, None)
145 Authentication token.
146
147 If the x\_auth\_token is not provided, then the environment variable \ :envvar:`OME\_X\_AUTH\_TOKEN`\ is used.
148
149 Example: export OME\_X\_AUTH\_TOKEN=x\_auth\_token
150
151
152 port (optional, int, 443)
153 OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port.
154
155
156 validate_certs (optional, bool, True)
157 If \ :literal:`false`\ , the SSL certificates will not be validated.
158
159 Configure \ :literal:`false`\ only on personally controlled sites where self-signed certificates are used.
160
161 Prior to collection version \ :literal:`5.0.0`\ , the \ :emphasis:`validate\_certs`\ is \ :literal:`false`\ by default.
162
163
164 ca_path (optional, path, None)
165 The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.
166
167
168 timeout (optional, int, 30)
169 The socket level timeout in seconds.
170
171
172
173
174
175 Notes
176 -----
177
178 .. note::
179 - Run this module from a system that has direct access to Dell OpenManage Enterprise.
180 - This module supports \ :literal:`check\_mode`\ .
181
182
183
184
185 Examples
186 --------
187
188 .. code-block:: yaml+jinja
189
190
191 ---
192 - name: Create a template from a reference device
193 dellemc.openmanage.ome_template:
194 hostname: "192.168.0.1"
195 username: "username"
196 password: "password"
197 ca_path: "/path/to/ca_cert.pem"
198 device_id: 25123
199 attributes:
200 Name: "New Template"
201 Description: "New Template description"
202
203 - name: Modify template name, description, and attribute value
204 dellemc.openmanage.ome_template:
205 hostname: "192.168.0.1"
206 username: "username"
207 password: "password"
208 ca_path: "/path/to/ca_cert.pem"
209 command: "modify"
210 template_id: 12
211 attributes:
212 Name: "New Custom Template"
213 Description: "Custom Template Description"
214 # Attributes to be modified in the template.
215 # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
216 # This section is optional
217 Attributes:
218 - Id: 1234
219 Value: "Test Attribute"
220 IsIgnored: false
221
222 - name: Modify template name, description, and attribute using detailed view
223 dellemc.openmanage.ome_template:
224 hostname: "192.168.0.1"
225 username: "username"
226 password: "password"
227 ca_path: "/path/to/ca_cert.pem"
228 command: "modify"
229 template_id: 12
230 attributes:
231 Name: "New Custom Template"
232 Description: "Custom Template Description"
233 Attributes:
234 # Enter the comma separated string as appearing in the Detailed view on GUI
235 # NIC -> NIC.Integrated.1-1-1 -> NIC Configuration -> Wake On LAN1
236 - DisplayName: 'NIC, NIC.Integrated.1-1-1, NIC Configuration, Wake On LAN'
237 Value: Enabled
238 IsIgnored: false
239 # System -> LCD Configuration -> LCD 1 User Defined String for LCD
240 - DisplayName: 'System, LCD Configuration, LCD 1 User Defined String for LCD'
241 Value: LCD str by OMAM
242 IsIgnored: false
243
244 - name: Deploy template on multiple devices
245 dellemc.openmanage.ome_template:
246 hostname: "192.168.0.1"
247 username: "username"
248 password: "password"
249 ca_path: "/path/to/ca_cert.pem"
250 command: "deploy"
251 template_id: 12
252 device_id:
253 - 12765
254 - 10173
255 device_service_tag:
256 - 'SVTG123'
257 - 'SVTG456'
258
259 - name: Deploy template on groups
260 dellemc.openmanage.ome_template:
261 hostname: "192.168.0.1"
262 username: "username"
263 password: "password"
264 ca_path: "/path/to/ca_cert.pem"
265 command: "deploy"
266 template_id: 12
267 device_group_names:
268 - server_group_1
269 - server_group_2
270
271 - name: Deploy template on multiple devices along with the attributes values to be modified on the target devices
272 dellemc.openmanage.ome_template:
273 hostname: "192.168.0.1"
274 username: "username"
275 password: "password"
276 ca_path: "/path/to/ca_cert.pem"
277 command: "deploy"
278 template_id: 12
279 device_id:
280 - 12765
281 - 10173
282 device_service_tag:
283 - 'SVTG123'
284 attributes:
285 # Device specific attributes to be modified during deployment.
286 # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
287 # This section is optional
288 Attributes:
289 # specific device where attribute to be modified at deployment run-time.
290 # The DeviceId should be mentioned above in the 'device_id' section.
291 # Service tags not allowed.
292 - DeviceId: 12765
293 Attributes:
294 - Id: 15645
295 Value: "0.0.0.0"
296 IsIgnored: false
297 - DeviceId: 10173
298 Attributes:
299 - Id: 18968,
300 Value: "hostname-1"
301 IsIgnored: false
302
303 - name: Deploy template and Operating System (OS) on multiple devices
304 dellemc.openmanage.ome_template:
305 hostname: "192.168.0.1"
306 username: "username"
307 password: "password"
308 ca_path: "/path/to/ca_cert.pem"
309 command: "deploy"
310 template_id: 12
311 device_id:
312 - 12765
313 device_service_tag:
314 - 'SVTG123'
315 attributes:
316 # Include this to install OS on the devices.
317 # This section is optional
318 NetworkBootIsoModel:
319 BootToNetwork: true
320 ShareType: "NFS"
321 IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
322 IsoPath: "/home/iso_path/filename.iso"
323 ShareDetail:
324 IpAddress: "192.168.0.2"
325 ShareName: "sharename"
326 User: "share_user"
327 Password: "share_password"
328 Options:
329 EndHostPowerState: 1
330 ShutdownType: 0
331 TimeToWaitBeforeShutdown: 300
332 Schedule:
333 RunLater: true
334 RunNow: false
335
336 - name: "Deploy template on multiple devices and changes the device-level attributes. After the template is deployed,
337 install OS using its image"
338 dellemc.openmanage.ome_template:
339 hostname: "192.168.0.1"
340 username: "username"
341 password: "password"
342 ca_path: "/path/to/ca_cert.pem"
343 command: "deploy"
344 template_id: 12
345 device_id:
346 - 12765
347 - 10173
348 device_service_tag:
349 - 'SVTG123'
350 - 'SVTG456'
351 attributes:
352 Attributes:
353 - DeviceId: 12765
354 Attributes:
355 - Id: 15645
356 Value: "0.0.0.0"
357 IsIgnored: false
358 - DeviceId: 10173
359 Attributes:
360 - Id: 18968,
361 Value: "hostname-1"
362 IsIgnored: false
363 NetworkBootIsoModel:
364 BootToNetwork: true
365 ShareType: "NFS"
366 IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
367 IsoPath: "/home/iso_path/filename.iso"
368 ShareDetail:
369 IpAddress: "192.168.0.2"
370 ShareName: "sharename"
371 User: "share_user"
372 Password: "share_password"
373 Options:
374 EndHostPowerState: 1
375 ShutdownType: 0
376 TimeToWaitBeforeShutdown: 300
377 Schedule:
378 RunLater: true
379 RunNow: false
380
381 - name: Delete template
382 dellemc.openmanage.ome_template:
383 hostname: "192.168.0.1"
384 username: "username"
385 password: "password"
386 ca_path: "/path/to/ca_cert.pem"
387 command: "delete"
388 template_id: 12
389
390 - name: Export a template
391 dellemc.openmanage.ome_template:
392 hostname: "192.168.0.1"
393 username: "username"
394 password: "password"
395 ca_path: "/path/to/ca_cert.pem"
396 command: "export"
397 template_id: 12
398
399 # Start of example to export template to a local xml file
400 - name: Export template to a local xml file
401 dellemc.openmanage.ome_template:
402 hostname: "192.168.0.1"
403 username: "username"
404 password: "password"
405 ca_path: "/path/to/ca_cert.pem"
406 command: "export"
407 template_name: "my_template"
408 register: result
409 - name: Save template into a file
410 ansible.builtin.copy:
411 content: "{{ result.Content}}"
412 dest: "/path/to/exported_template.xml"
413 # End of example to export template to a local xml file
414
415 - name: Clone a template
416 dellemc.openmanage.ome_template:
417 hostname: "192.168.0.1"
418 username: "username"
419 password: "password"
420 ca_path: "/path/to/ca_cert.pem"
421 command: "clone"
422 template_id: 12
423 attributes:
424 Name: "New Cloned Template Name"
425
426 - name: Import template from XML content
427 dellemc.openmanage.ome_template:
428 hostname: "192.168.0.1"
429 username: "username"
430 password: "password"
431 ca_path: "/path/to/ca_cert.pem"
432 command: "import"
433 attributes:
434 Name: "Imported Template Name"
435 # Template Type from TemplateService/TemplateTypes
436 Type: 2
437 # xml string content
438 Content: "<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"SVCTAG1\"
439 TimeStamp=\"Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute
440 Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\">Clear</Attribute>\n
441 </Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready
442 </Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n
443 <Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n
444 <Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n</SystemConfiguration>\n"
445
446 - name: Import template from local XML file
447 dellemc.openmanage.ome_template:
448 hostname: "192.168.0.1"
449 username: "username"
450 password: "password"
451 ca_path: "/path/to/ca_cert.pem"
452 command: "import"
453 attributes:
454 Name: "Imported Template Name"
455 Type: 2
456 Content: "{{ lookup('ansible.builtin.file', '/path/to/xmlfile') }}"
457
458 - name: "Deploy template and Operating System (OS) on multiple devices."
459 dellemc.openmanage.ome_template:
460 hostname: "192.168.0.1"
461 username: "username"
462 password: "password"
463 ca_path: "/path/to/ca_cert.pem"
464 command: "deploy"
465 template_id: 12
466 device_id:
467 - 12765
468 device_service_tag:
469 - 'SVTG123'
470 attributes:
471 # Include this to install OS on the devices.
472 # This section is optional
473 NetworkBootIsoModel:
474 BootToNetwork: true
475 ShareType: "CIFS"
476 IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
477 IsoPath: "/home/iso_path/filename.iso"
478 ShareDetail:
479 IpAddress: "192.168.0.2"
480 ShareName: "sharename"
481 User: "share_user"
482 Password: "share_password"
483 Options:
484 EndHostPowerState: 1
485 ShutdownType: 0
486 TimeToWaitBeforeShutdown: 300
487 Schedule:
488 RunLater: true
489 RunNow: false
490
491 - name: Create a compliance template from reference device
492 dellemc.openmanage.ome_template:
493 hostname: "192.168.0.1"
494 username: "username"
495 password: "password"
496 ca_path: "/path/to/ca_cert.pem"
497 command: "create"
498 device_service_tag:
499 - "SVTG123"
500 template_view_type: "Compliance"
501 attributes:
502 Name: "Configuration Compliance"
503 Description: "Configuration Compliance Template"
504 Fqdds: "BIOS"
505
506 - name: Import a compliance template from XML file
507 dellemc.openmanage.ome_template:
508 hostname: "192.168.0.1"
509 username: "username"
510 password: "password"
511 ca_path: "/path/to/ca_cert.pem"
512 command: "import"
513 template_view_type: "Compliance"
514 attributes:
515 Name: "Configuration Compliance"
516 Content: "{{ lookup('ansible.builtin.file', './test.xml') }}"
517 Type: 2
518
519 - name: Create a template from a reference device with Job wait as false
520 dellemc.openmanage.ome_template:
521 hostname: "192.168.0.1"
522 username: "username"
523 password: "password"
524 ca_path: "/path/to/ca_cert.pem"
525 device_id: 25123
526 attributes:
527 Name: "New Template"
528 Description: "New Template description"
529 Fqdds: iDRAC,BIOS,
530 job_wait: false
531
532
533
534 Return Values
535 -------------
536
537 msg (always, str, Successfully created a template with ID 23)
538 Overall status of the template operation.
539
540
541 return_id (success, when I(command) is C(create), C(modify), C(import), C(clone) and C(deploy), int, 12)
542 ID of the template for \ :literal:`create`\ , \ :literal:`modify`\ , \ :literal:`import`\ and \ :literal:`clone`\ or task created in case of \ :literal:`deploy`\ .
543
544
545 TemplateId (success, when I(command) is C(export), int, 13)
546 ID of the template for \ :literal:`export`\ .
547
548
549 Content (success, when I(command) is C(export), str, <SystemConfiguration Model="PowerEdge R940" ServiceTag="DEFG123" TimeStamp="Tue Sep 24 09:20:57.872551 2019">
550 <Component FQDD="AHCI.Slot.6-1">
551 <Attribute Name="RAIDresetConfig">True</Attribute>
552 <Attribute Name="RAIDforeignConfig">Clear</Attribute>
553 </Component>
554 <Component FQDD="Disk.Direct.0-0:AHCI.Slot.6-1">
555 <Attribute Name="RAIDPDState">Ready</Attribute>
556 <Attribute Name="RAIDHotSpareStatus">No</Attribute>
557 </Component>
558 <Component FQDD="Disk.Direct.1-1:AHCI.Slot.6-1">
559 <Attribute Name="RAIDPDState">Ready </Attribute>
560 <Attribute Name="RAIDHotSpareStatus">No</Attribute>
561 </Component>
562 </SystemConfiguration>)
563 XML content of the exported template. This content can be written to a xml file.
564
565
566 devices_assigned (I(command) is C(deploy), dict, {'10362': 28, '10312': 23})
567 Mapping of devices with the templates already deployed on them.
568
569
570 error_info (on HTTP error, dict, {'error': {'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.', '@Message.ExtendedInfo': [{'MessageId': 'GEN1234', 'RelatedProperties': [], 'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'Severity': 'Critical', 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.'}]}})
571 Details of the HTTP Error.
572
573
574
575
576
577 Status
578 ------
579
580
581
582
583
584 Authors
585 ~~~~~~~
586
587 - Jagadeesh N V (@jagadeeshnv)
588 - Husniya Hameed (@husniya_hameed)
589 - Kritika Bhateja (@Kritika-Bhateja)
590 - Meenakshi Dembi(@meenakshidembi691)