forked from opiproject/ansible-opi-dpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Boris Glimcher <[email protected]>
- Loading branch information
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- name: Update DPU Firmware | ||
hosts: all | ||
gather_facts: false | ||
roles: | ||
- bmc_fw_update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,79 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2022-2024 Dell Inc, or its subsidiaries. | ||
|
||
--- | ||
# tasks file for bmc_fw_update | ||
|
||
- name: Get Firmware Inventory | ||
include_role: | ||
name: get_bmc_facts | ||
register: fw_inventory_before | ||
|
||
- name: Print BMC Version | ||
ansible.builtin.debug: | ||
msg: "{{ fw_inventory_before.redfish_facts.firmware.entries[0].Version }}" | ||
|
||
- name: Download firmware {{ firmware.bmc }} image | ||
ansible.builtin.get_url: | ||
url: "{{ firmware.url }}/{{ firmware.bmc }}" | ||
dest: /tmp/{{ firmware.bmc }} | ||
mode: '0440' | ||
delegate_to: localhost | ||
|
||
- name: Update BMC firmware of DPU | ||
community.general.redfish_command: | ||
category: Update | ||
command: MultipartHTTPPushUpdate | ||
baseuri: "{{ inventory_hostname }}" | ||
username: "{{ dpu_bmc_username }}" | ||
password: "{{ dpu_bmc_password }}" | ||
timeout: 600 | ||
update_image_file: "/tmp/{{ firmware.bmc }}" | ||
register: result_update_task | ||
delegate_to: localhost | ||
|
||
- ansible.builtin.set_fact: | ||
bmc_firmware_update_taskid: "{{ result_update_task.return_values.update_status.handle }}" | ||
|
||
- name: Print TASK id for tracking | ||
ansible.builtin.debug: | ||
msg: "{{ result_update_task.return_values.update_status.handle }}" | ||
|
||
- name: Pause for 10 seconds for BMC to start task | ||
ansible.builtin.pause: | ||
seconds: 10 | ||
|
||
- name: Get the status of an update operation in a loop | ||
community.general.redfish_info: | ||
category: Update | ||
command: GetUpdateStatus | ||
baseuri: "{{ inventory_hostname }}" | ||
username: "{{ dpu_bmc_username }}" | ||
password: "{{ dpu_bmc_password }}" | ||
update_handle: "{{ result_update_task.return_values.update_status.handle }}" | ||
register: update_progress | ||
until: update_progress.redfish_facts.update_status.status != 'Running' | ||
retries: 60 | ||
delay: 30 | ||
delegate_to: localhost | ||
|
||
- ansible.builtin.assert: { that: "update_progress.redfish_facts.update_status.status == 'Completed'" } | ||
|
||
- name: Reboot BMC to apply new firmware of DPU | ||
include_role: | ||
name: bmc_reboot | ||
|
||
- name: Pause for 60 seconds for BMC to Reboot | ||
ansible.builtin.pause: | ||
seconds: 60 | ||
|
||
- name: Get Firmware Inventory | ||
include_role: | ||
name: get_bmc_facts | ||
register: fw_inventory_after | ||
|
||
- name: Print BMC Version | ||
ansible.builtin.debug: | ||
msg: "{{ fw_inventory_after.redfish_facts.firmware.entries[0].Version }}" | ||
|
||
- ansible.builtin.assert: { that: "fw_inventory_before.redfish_facts.firmware.entries[0].Version != fw_inventory_after.redfish_facts.firmware.entries[0].Version" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
--- | ||
# vars file for bmc_fw_update | ||
|
||
firmware: | ||
url: https://content.mellanox.com/BlueField/BMC/23.10-1-oct-2023 | ||
bmc: bf3-bmc-23.10-5_opn.fwpkg | ||
cec: cec1736-ecfw-00.02.0152.0000-n02-rel-prod.fwpkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2022-2024 Dell Inc, or its subsidiaries. | ||
|
||
--- | ||
# tasks file for bmc_reboot | ||
|
||
- name: Reboot BMC to apply new firmware of DPU | ||
community.general.redfish_command: | ||
category: Manager | ||
command: GracefulRestart | ||
baseuri: "{{ inventory_hostname }}" | ||
username: "{{ dpu_bmc_username }}" | ||
password: "{{ dpu_bmc_password }}" | ||
delegate_to: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2022-2024 Dell Inc, or its subsidiaries. | ||
|
||
--- | ||
# tasks file for get_bmc_facts | ||
|
||
- name: Get Firmware Inventory | ||
community.general.redfish_info: | ||
category: Update | ||
command: GetFirmwareInventory | ||
baseuri: "{{ inventory_hostname }}" | ||
username: "{{ dpu_bmc_username }}" | ||
password: "{{ dpu_bmc_password }}" | ||
register: result | ||
delegate_to: localhost | ||
|
||
- ansible.builtin.set_fact: | ||
bmc_firmware_version: "{{ result.redfish_facts.firmware.entries[0].Version }}" |