| 1 |
--- |
| 2 |
- name: Dell OpenManage Ansible device Template service. |
| 3 |
hosts: ome |
| 4 |
gather_facts: false |
| 5 |
|
| 6 |
tasks: |
| 7 |
- name: Create a template from a reference device. |
| 8 |
dellemc.openmanage.ome_template: |
| 9 |
hostname: "{{ hostname }}" |
| 10 |
username: "{{ username }}" |
| 11 |
password: "{{ password }}" |
| 12 |
ca_path: "/path/to/ca_cert.pem" |
| 13 |
device_id: 25123 |
| 14 |
attributes: |
| 15 |
Name: "New Template" |
| 16 |
Description: "New Template description" |
| 17 |
delegate_to: localhost |
| 18 |
|
| 19 |
- name: Modify template name, description, and attribute value. |
| 20 |
dellemc.openmanage.ome_template: |
| 21 |
hostname: "{{ hostname }}" |
| 22 |
username: "{{ username }}" |
| 23 |
password: "{{ password }}" |
| 24 |
ca_path: "/path/to/ca_cert.pem" |
| 25 |
command: "modify" |
| 26 |
template_id: 12 |
| 27 |
attributes: |
| 28 |
Name: "New Custom Template" |
| 29 |
Description: "Custom Template Description" |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
Attributes: |
| 34 |
- Id: 1234 |
| 35 |
Value: "Test Attribute" |
| 36 |
IsIgnored: false |
| 37 |
delegate_to: localhost |
| 38 |
|
| 39 |
- name: Modify template name, description, and attribute using detailed view |
| 40 |
dellemc.openmanage.ome_template: |
| 41 |
hostname: "{{ hostname }}" |
| 42 |
username: "{{ username }}" |
| 43 |
password: "{{ password }}" |
| 44 |
ca_path: "/path/to/ca_cert.pem" |
| 45 |
command: "modify" |
| 46 |
template_id: 12 |
| 47 |
attributes: |
| 48 |
Name: "New Custom Template" |
| 49 |
Description: "Custom Template Description" |
| 50 |
Attributes: |
| 51 |
|
| 52 |
|
| 53 |
- DisplayName: "NIC, NIC.Integrated.1-1-1, NIC Configuration, Wake On LAN" |
| 54 |
Value: Enabled |
| 55 |
IsIgnored: false |
| 56 |
|
| 57 |
- DisplayName: "System, LCD Configuration, LCD 1 User Defined String for LCD" |
| 58 |
Value: LCD str by OMAM |
| 59 |
IsIgnored: false |
| 60 |
delegate_to: localhost |
| 61 |
|
| 62 |
- name: Deploy template on multiple devices |
| 63 |
dellemc.openmanage.ome_template: |
| 64 |
hostname: "192.168.0.1" |
| 65 |
username: "username" |
| 66 |
password: "password" |
| 67 |
ca_path: "/path/to/ca_cert.pem" |
| 68 |
command: "deploy" |
| 69 |
template_id: 12 |
| 70 |
device_id: |
| 71 |
- 12765 |
| 72 |
- 10173 |
| 73 |
device_service_tag: |
| 74 |
- "SVTG123" |
| 75 |
- "SVTG456" |
| 76 |
delegate_to: localhost |
| 77 |
|
| 78 |
- name: Deploy template on groups |
| 79 |
dellemc.openmanage.ome_template: |
| 80 |
hostname: "{{ hostname }}" |
| 81 |
username: "{{ username }}" |
| 82 |
password: "{{ password }}" |
| 83 |
ca_path: "/path/to/ca_cert.pem" |
| 84 |
command: "deploy" |
| 85 |
template_id: 12 |
| 86 |
device_group_names: |
| 87 |
- server_group_1 |
| 88 |
- server_group_2 |
| 89 |
delegate_to: localhost |
| 90 |
|
| 91 |
- name: Deploy template on multiple devices along attributes modification for target device" |
| 92 |
dellemc.openmanage.ome_template: |
| 93 |
hostname: "{{ hostname }}" |
| 94 |
username: "{{ username }}" |
| 95 |
password: "{{ password }}" |
| 96 |
ca_path: "/path/to/ca_cert.pem" |
| 97 |
command: "deploy" |
| 98 |
template_id: 12 |
| 99 |
device_id: |
| 100 |
- 12765 |
| 101 |
- 10173 |
| 102 |
device_service_tag: |
| 103 |
- "SVTG123" |
| 104 |
attributes: |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
Attributes: |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
- DeviceId: 12765 |
| 113 |
Attributes: |
| 114 |
- Id: 15645 |
| 115 |
Value: "0.0.0.0" |
| 116 |
IsIgnored: false |
| 117 |
- DeviceId: 10173 |
| 118 |
Attributes: |
| 119 |
- Id: 18968, |
| 120 |
Value: "hostname-1" |
| 121 |
IsIgnored: false |
| 122 |
delegate_to: localhost |
| 123 |
|
| 124 |
- name: Deploy template and Operating System (OS) on multiple devices" |
| 125 |
dellemc.openmanage.ome_template: |
| 126 |
hostname: "{{ hostname }}" |
| 127 |
username: "{{ username }}" |
| 128 |
password: "{{ password }}" |
| 129 |
ca_path: "/path/to/ca_cert.pem" |
| 130 |
command: "deploy" |
| 131 |
template_id: 12 |
| 132 |
device_id: |
| 133 |
- 12765 |
| 134 |
device_service_tag: |
| 135 |
- "SVTG123" |
| 136 |
attributes: |
| 137 |
|
| 138 |
|
| 139 |
NetworkBootIsoModel: |
| 140 |
BootToNetwork: true |
| 141 |
ShareType: "NFS" |
| 142 |
IsoTimeout: 1 |
| 143 |
IsoPath: "/home/iso_path/filename.iso" |
| 144 |
ShareDetail: |
| 145 |
IpAddress: "192.168.0.2" |
| 146 |
ShareName: "sharename" |
| 147 |
User: "share_user" |
| 148 |
Password: "share_password" |
| 149 |
Options: |
| 150 |
EndHostPowerState: 1 |
| 151 |
ShutdownType: 0 |
| 152 |
TimeToWaitBeforeShutdown: 300 |
| 153 |
Schedule: |
| 154 |
RunLater: true |
| 155 |
RunNow: false |
| 156 |
delegate_to: localhost |
| 157 |
|
| 158 |
- name: |
| 159 |
Deploy template on multiple devices and changes the device-level attributes. After the template is deployed, |
| 160 |
install OS using its image. |
| 161 |
dellemc.openmanage.ome_template: |
| 162 |
hostname: "{{ hostname }}" |
| 163 |
username: "{{ username }}" |
| 164 |
password: "{{ password }}" |
| 165 |
ca_path: "/path/to/ca_cert.pem" |
| 166 |
command: "deploy" |
| 167 |
template_id: 12 |
| 168 |
device_id: |
| 169 |
- 12765 |
| 170 |
- 10173 |
| 171 |
device_service_tag: |
| 172 |
- "SVTG123" |
| 173 |
- "SVTG456" |
| 174 |
attributes: |
| 175 |
Attributes: |
| 176 |
- DeviceId: 12765 |
| 177 |
Attributes: |
| 178 |
- Id: 15645 |
| 179 |
Value: "0.0.0.0" |
| 180 |
IsIgnored: false |
| 181 |
- DeviceId: 10173 |
| 182 |
Attributes: |
| 183 |
- Id: 18968, |
| 184 |
Value: "hostname-1" |
| 185 |
IsIgnored: false |
| 186 |
NetworkBootIsoModel: |
| 187 |
BootToNetwork: true |
| 188 |
ShareType: "NFS" |
| 189 |
IsoTimeout: 1 |
| 190 |
IsoPath: "/home/iso_path/filename.iso" |
| 191 |
ShareDetail: |
| 192 |
IpAddress: "192.168.0.2" |
| 193 |
ShareName: "sharename" |
| 194 |
User: "share_user" |
| 195 |
Password: "share_password" |
| 196 |
Options: |
| 197 |
EndHostPowerState: 1 |
| 198 |
ShutdownType: 0 |
| 199 |
TimeToWaitBeforeShutdown: 300 |
| 200 |
Schedule: |
| 201 |
RunLater: true |
| 202 |
RunNow: false |
| 203 |
delegate_to: localhost |
| 204 |
|
| 205 |
- name: Delete template" |
| 206 |
dellemc.openmanage.ome_template: |
| 207 |
hostname: "{{ hostname }}" |
| 208 |
username: "{{ username }}" |
| 209 |
password: "{{ password }}" |
| 210 |
ca_path: "/path/to/ca_cert.pem" |
| 211 |
command: "delete" |
| 212 |
template_id: 12 |
| 213 |
delegate_to: localhost |
| 214 |
|
| 215 |
- name: Export a template |
| 216 |
dellemc.openmanage.ome_template: |
| 217 |
hostname: "{{ hostname }}" |
| 218 |
username: "{{ username }}" |
| 219 |
password: "{{ password }}" |
| 220 |
ca_path: "/path/to/ca_cert.pem" |
| 221 |
command: "export" |
| 222 |
template_id: 12 |
| 223 |
delegate_to: localhost |
| 224 |
|
| 225 |
|
| 226 |
- name: Export template to a local xml file |
| 227 |
dellemc.openmanage.ome_template: |
| 228 |
hostname: "{{ hostname }}" |
| 229 |
username: "{{ username }}" |
| 230 |
password: "{{ password }}" |
| 231 |
ca_path: "/path/to/ca_cert.pem" |
| 232 |
command: "export" |
| 233 |
template_name: "my_template" |
| 234 |
register: result |
| 235 |
tags: |
| 236 |
- export_xml_to_file |
| 237 |
- name: Copy Task |
| 238 |
ansible.builtin.copy: |
| 239 |
content: "{{ result.Content }}" |
| 240 |
dest: "/path/to/exported_template.xml" |
| 241 |
mode: "0600" |
| 242 |
tags: |
| 243 |
- export_xml_to_file |
| 244 |
|
| 245 |
delegate_to: localhost |
| 246 |
|
| 247 |
- name: Clone a template |
| 248 |
dellemc.openmanage.ome_template: |
| 249 |
hostname: "{{ hostname }}" |
| 250 |
username: "{{ username }}" |
| 251 |
password: "{{ password }}" |
| 252 |
ca_path: "/path/to/ca_cert.pem" |
| 253 |
command: "clone" |
| 254 |
template_id: 12 |
| 255 |
attributes: |
| 256 |
Name: "New Cloned Template Name" |
| 257 |
delegate_to: localhost |
| 258 |
|
| 259 |
- name: Import template from XML content |
| 260 |
dellemc.openmanage.ome_template: |
| 261 |
hostname: "{{ hostname }}" |
| 262 |
username: "{{ username }}" |
| 263 |
password: "{{ password }}" |
| 264 |
ca_path: "/path/to/ca_cert.pem" |
| 265 |
command: "import" |
| 266 |
attributes: |
| 267 |
Name: "Imported Template Name" |
| 268 |
|
| 269 |
Type: 2 |
| 270 |
|
| 271 |
Content: |
| 272 |
"<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"SVCTAG1\" |
| 273 |
TimeStamp=\"Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute |
| 274 |
Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\">Clear</Attribute>\n |
| 275 |
</Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready |
| 276 |
</Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n |
| 277 |
<Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n |
| 278 |
<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n</SystemConfiguration>\n" |
| 279 |
delegate_to: localhost |
| 280 |
|
| 281 |
- name: Import template from local XML file |
| 282 |
dellemc.openmanage.ome_template: |
| 283 |
hostname: "{{ hostname }}" |
| 284 |
username: "{{ username }}" |
| 285 |
password: "{{ password }}" |
| 286 |
ca_path: "/path/to/ca_cert.pem" |
| 287 |
command: "import" |
| 288 |
attributes: |
| 289 |
Name: "Imported Template Name" |
| 290 |
Type: 2 |
| 291 |
Content: "{{ contents_of_file_located_at_/path/to/xmlfile }}" |
| 292 |
delegate_to: localhost |
| 293 |
|
| 294 |
- name: Deploy template and Operating System (OS) on multiple devices." |
| 295 |
dellemc.openmanage.ome_template: |
| 296 |
hostname: "{{ hostname }}" |
| 297 |
username: "{{ username }}" |
| 298 |
password: "{{ password }}" |
| 299 |
ca_path: "/path/to/ca_cert.pem" |
| 300 |
command: "deploy" |
| 301 |
template_id: 12 |
| 302 |
device_id: |
| 303 |
- 12765 |
| 304 |
device_service_tag: |
| 305 |
- "SVTG123" |
| 306 |
attributes: |
| 307 |
|
| 308 |
|
| 309 |
NetworkBootIsoModel: |
| 310 |
BootToNetwork: true |
| 311 |
ShareType: "CIFS" |
| 312 |
IsoTimeout: 1 |
| 313 |
IsoPath: "/home/iso_path/filename.iso" |
| 314 |
ShareDetail: |
| 315 |
IpAddress: "192.168.0.2" |
| 316 |
ShareName: "sharename" |
| 317 |
User: "share_user" |
| 318 |
Password: "share_password" |
| 319 |
Options: |
| 320 |
EndHostPowerState: 1 |
| 321 |
ShutdownType: 0 |
| 322 |
TimeToWaitBeforeShutdown: 300 |
| 323 |
Schedule: |
| 324 |
RunLater: true |
| 325 |
RunNow: false |
| 326 |
delegate_to: localhost |
| 327 |
|
| 328 |
- name: Create a compliance template from reference device |
| 329 |
dellemc.openmanage.ome_template: |
| 330 |
hostname: "{{ hostname }}" |
| 331 |
username: "{{ username }}" |
| 332 |
password: "{{ password }}" |
| 333 |
ca_path: "/path/to/ca_cert.pem" |
| 334 |
command: "create" |
| 335 |
device_service_tag: "SVTG123" |
| 336 |
template_view_type: "Compliance" |
| 337 |
attributes: |
| 338 |
Name: "Configuration Compliance" |
| 339 |
Description: "Configuration Compliance Template" |
| 340 |
Fqdds: "BIOS" |
| 341 |
delegate_to: localhost |
| 342 |
|
| 343 |
- name: Import a compliance template from XML file |
| 344 |
dellemc.openmanage.ome_template: |
| 345 |
hostname: "{{ hostname }}" |
| 346 |
username: "{{ username }}" |
| 347 |
password: "{{ password }}" |
| 348 |
ca_path: "/path/to/ca_cert.pem" |
| 349 |
command: "import" |
| 350 |
template_view_type: "Compliance" |
| 351 |
attributes: |
| 352 |
Name: "Configuration Compliance" |
| 353 |
Content: "{{ contents_of_file_located_at_/path/to/xmlfile }}" |
| 354 |
Type: 2 |
| 355 |
delegate_to: localhost |