Skip to content
Snippets Groups Projects
Commit cd33e4a7 authored by Mark Goddard's avatar Mark Goddard
Browse files

Add playbooks for interactions with DRACs

Currently includes gathering facts, configuring the BIOS and setting the boot
order (sadly not via the drac role).
parent 54ff228b
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,8 @@ ansible/roles/ahuffman.resolv/ ...@@ -19,6 +19,8 @@ ansible/roles/ahuffman.resolv/
ansible/roles/jriguera.configdrive/ ansible/roles/jriguera.configdrive/
ansible/roles/mrlesmithjr.manage-lvm/ ansible/roles/mrlesmithjr.manage-lvm/
ansible/roles/MichaelRigart.interfaces/ ansible/roles/MichaelRigart.interfaces/
ansible/roles/stackhpc.drac/
ansible/roles/stackhpc.drac-facts/
ansible/roles/resmo.ntp/ ansible/roles/resmo.ntp/
ansible/roles/yatesr.timezone/ ansible/roles/yatesr.timezone/
......
---
- name: Ensure that controller BIOS are configured
hosts: controllers
gather_facts: no
vars:
bios_config:
OneTimeBootMode: "OneTimeBootSeq"
OneTimeBootSeqDev: NIC.Integrated.1-1-1
roles:
- role: stackhpc.drac
drac_address: "{{ ipmi_address }}"
drac_username: "{{ ipmi_username }}"
drac_password: "{{ ipmi_password }}"
drac_bios_config: "{{ bios_config }}"
drac_reboot: True
tasks:
- name: Ensure BIOS configuration is applied
command: "racadm {{ item }}"
with_items:
- set Nic.NICConfig.1.LegacyBootProto NONE
- jobqueue create NIC.Integrated.1-1-1 -s TIME_NOW
- set Nic.NICConfig.2.LegacyBootProto NONE
- jobqueue create NIC.Integrated.1-2-1 -s TIME_NOW
- set Nic.NICConfig.3.LegacyBootProto PXE
- jobqueue create NIC.Integrated.1-3-1 -s TIME_NOW
- set Nic.NICConfig.4.LegacyBootProto NONE
- jobqueue create NIC.Integrated.1-4-1 -s TIME_NOW
- set BIOS.BiosBootSettings.bootseq NIC.Integrated.1-3-1,HardDisk.List.1-1,Optical.SATAEmbedded.J-1
- jobqueue create BIOS.Setup.1-1
- serveraction powercycle
---
- name: Ensure that controller boot order is configured
hosts: controllers
gather_facts: no
vars:
ansible_host: "{{ ipmi_address }}"
ansible_user: "{{ ipmi_username }}"
ansible_ssh_pass: "{{ ipmi_password }}"
drac_pxe_interface: 3
drac_interfaces: [1, 2, 3, 4]
tasks:
- name: Ensure NIC boot protocol is configured
raw: "racadm set Nic.NICConfig.{{ item }}.LegacyBootProto {% if item == drac_pxe_interface %}PXE{% else %}NONE{% endif %}"
with_items: "{{ drac_interfaces }}"
- name: Ensure NIC configuration jobs are created
raw: "racadm jobqueue create NIC.Integrated.1-{{ item }}-1 -s TIME_NOW"
with_items: "{{ drac_interfaces }}"
- name: Ensure BIOS boot sequence is configured
raw: "racadm set BIOS.BiosBootSettings.bootseq NIC.Integrated.1-{{ drac_pxe_interface }}-1,HardDisk.List.1-1,Optical.SATAEmbedded.J-1"
- name: Ensure BIOS configuration job is created
raw: "racadm jobqueue create BIOS.Setup.1-1"
- name: Ensure server is rebooted
raw: "racadm serveraction powercycle"
---
- name: Ensure that controller BIOS are configured
hosts: controllers
gather_facts: no
roles:
# The role simply pulls in the drac_facts module.
- role: stackhpc.drac-facts
tasks:
- name: Gather facts via DRAC
local_action:
module: drac_facts
address: "{{ ipmi_address }}"
username: "{{ ipmi_username }}"
password: "{{ ipmi_password }}"
register: result
- name: Display results
debug:
var: result
- name: Write facts to a file
local_action:
module: copy
content: "{{ result }}"
dest: "/tmp/drac-facts-{{ inventory_hostname }}.json"
...@@ -4,4 +4,6 @@ ...@@ -4,4 +4,6 @@
- src: MichaelRigart.interfaces - src: MichaelRigart.interfaces
- src: mrlesmithjr.manage-lvm - src: mrlesmithjr.manage-lvm
- src: resmo.ntp - src: resmo.ntp
- src: stackhpc.drac
- src: stackhpc.drac-facts
- src: yatesr.timezone - src: yatesr.timezone
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment