Skip to content

Commit

Permalink
fix(ansible): fixing config job and reboot tasks in bios.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul <[email protected]>
  • Loading branch information
rahulsachdev committed Jul 9, 2024
1 parent 6642249 commit a5b2e5e
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ansible/bios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@
username: "{{ ansible_user | default(ansible_env.USER) }}"
password: "{{ ansible_password }}"
register: result
tags: ["TEST"]
#tags: ["TEST"]

- name: Debug print bios serial number
ansible.builtin.debug: msg={{ result.redfish_facts.bios_attribute.entries[0][1].SerialNumber | default(result.redfish_facts.bios_attribute.entries[0][1].SystemServiceTag) }}


- name: Debug print bios serial number
when: inventory_hostname == 'dh1bmc'
ansible.builtin.debug: msg={{ result.redfish_facts.bios_attribute.entries[0][1].AcPwrRcvryUserDelay | default(result.redfish_facts.bios_attribute.entries[0][1].SystemServiceTag) }}
tags: ["TEST"]

# TODO: configre BIOS to be always on ( see lab/hardware/dh123) and any virtualization or hyper threading settings we might need
#- name: Debug print bios attributes
#ansible.builtin.debug: msg={{ result }}
#ansible.builtin.debug: msg={{ result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer }}
#when: result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
#tags: ["TEST"]

# Updating Bios attributes in host BMCs
- name: Set BIOS attributes
Expand All @@ -50,28 +49,30 @@
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
register: bios_attribute
# tags: ["TEST"]

# DELL ONLY: Updating BIOS settings requires creating a configuration job
# DELL iDRAC ONLY: Updating BIOS settings requires creating a configuration job
# to schedule the BIOS update, so comment out below for non-Dell systems.

- name: Create BIOS configuration job (schedule BIOS setting update)
when: inventory_hostname == 'dh1bmc'
when: result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined and result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc." and bios_attribute.changed
community.general.idrac_redfish_command:
category: Systems
command: CreateBiosConfigJob
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
when: bios_attribute.changed
register: bios_config_job
# tags: ["TEST"]

- name: Reboot system to apply new BIOS settings
when: inventory_hostname == 'dh1bmc'
#when: result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined and result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc." and bios_config_job.changed
when: inventory_hostname == 'dh4bmc'
community.general.redfish_command:
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
when: bios_config_job.changed
#tags: ["TEST"]

0 comments on commit a5b2e5e

Please sign in to comment.