-
Notifications
You must be signed in to change notification settings - Fork 1
/
idrac-boot-pxe-onetime.yml
executable file
·69 lines (59 loc) · 2.17 KB
/
idrac-boot-pxe-onetime.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###
# Playbook will get the current Boot Mode (UEFI/BIOS) and set OneTimeBoot to PXE device.
# The 'idrac_bios' module will automatically apply changes, reboot the server and wait until the server has been rebooted.
###
---
- hosts: all
connection: local
name: Set One Time Boot to PXE
gather_facts: False
vars:
pxe_device: NIC.Integrated.1-1-1
vars_files:
- vault.yml
tasks:
- name: Get BIOS Attributes
community.general.redfish_info:
baseuri: "{{ oob_host }}"
username: "{{ vault_oob_username }}"
password: "{{ vault_oob_password }}"
category: Systems
command: GetBiosAttributes
register: result_attributes
- name: Get BIOS boot mode and set fact boot_mode
set_fact:
boot_mode: "{{ result_attributes.redfish_facts.bios_attribute.entries.0.1.BootMode }}"
- debug:
msg: "Boot mode set to {{ boot_mode }}"
- name: UEFI
block:
- name: Set OneTimeBoot (UEFI)
dellemc.openmanage.idrac_bios:
idrac_ip: "{{ oob_host }}"
idrac_user: "{{ vault_oob_username }}"
idrac_password: "{{ vault_oob_password }}"
attributes:
PxeDev1EnDis: "Enabled"
PxeDev1Interface: "{{ pxe_device }}"
OneTimeBootMode: "OneTimeUefiBootSeq"
OneTimeUefiBootSeqDev: "NIC.PxeDevice.1-1"
register: result
- debug:
var: result
when: boot_mode == "Uefi" # Only run block when boot mode is Uefi
- name: LegacyBoot
block:
- name: Set OneTimeBootMode (LegacyBoot)
dellemc.openmanage.idrac_bios:
baseuri: "{{ oob_host }}"
username: "{{ vault_oob_username }}"
password: "{{ vault_oob_password }}"
category: Systems
command: SetBiosAttributes
bios_attributes:
OneTimeBootMode: "OneTimeBootSeq"
OneTimeBootSeqDev: "{{ pxe_device }}"
register: result
- debug:
var: result
when: boot_mode == "Bios" # Only run block when boot mode is Bios