From 18e635d6244cd5784da4f9908df51801b0bf5875 Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Wed, 28 Feb 2024 02:07:23 +0200 Subject: [PATCH] fix(bmc_fw_update): move vars to argument_specs Fixed #37 Signed-off-by: Boris Glimcher --- docs/bmc_fw_update_role.rst | 82 +++++++++++++++++++++ roles/bmc_fw_update/defaults/main.yml | 2 + roles/bmc_fw_update/meta/argument_specs.yml | 10 +++ roles/bmc_fw_update/tasks/main.yml | 8 +- roles/bmc_fw_update/vars/main.yml | 4 - 5 files changed, 98 insertions(+), 8 deletions(-) diff --git a/docs/bmc_fw_update_role.rst b/docs/bmc_fw_update_role.rst index 8d6a54c..a9e2d40 100644 --- a/docs/bmc_fw_update_role.rst +++ b/docs/bmc_fw_update_role.rst @@ -75,6 +75,88 @@ Parameters * - Parameter - Comments + * - .. raw:: html + +
+
+ + .. _ansible_collections.opi.dpu.bmc_fw_update_role__parameter-main__bmc_fw_update_image_file: + + .. rst-class:: ansible-option-title + + **bmc_fw_update_image_file** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Local file of the BMC fw image, if exists bmc\_fw\_update\_image\_url is ignored. + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`"True"` + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.opi.dpu.bmc_fw_update_role__parameter-main__bmc_fw_update_image_url: + + .. rst-class:: ansible-option-title + + **bmc_fw_update_image_url** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`string` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + URL of the BMC fw image. Ignored if bmc\_fw\_update\_image\_file exists. + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`"True"` + + .. raw:: html + +
+ * - .. raw:: html
diff --git a/roles/bmc_fw_update/defaults/main.yml b/roles/bmc_fw_update/defaults/main.yml index 41d1957..9ff763c 100644 --- a/roles/bmc_fw_update/defaults/main.yml +++ b/roles/bmc_fw_update/defaults/main.yml @@ -6,3 +6,5 @@ bmc_fw_update_reboot: true bmc_fw_update_job_wait: true +bmc_fw_update_image_url: https://content.mellanox.com/BlueField/BMC/23.10-1-oct-2023/bf3-bmc-23.10-5_opn.fwpkg +bmc_fw_update_image_file: /tmp/bf3-bmc-23.10-5_opn.fwpkg diff --git a/roles/bmc_fw_update/meta/argument_specs.yml b/roles/bmc_fw_update/meta/argument_specs.yml index 7f5a336..bdfe10b 100644 --- a/roles/bmc_fw_update/meta/argument_specs.yml +++ b/roles/bmc_fw_update/meta/argument_specs.yml @@ -16,6 +16,16 @@ argument_specs: - Packages that do not require a reboot are applied immediately irrespective of I (reboot). type: bool default: true + bmc_fw_update_image_url: + description: + - URL of the BMC fw image. Ignored if bmc_fw_update_image_file exists. + type: str + default: true + bmc_fw_update_image_file: + description: + - Local file of the BMC fw image, if exists bmc_fw_update_image_url is ignored. + type: str + default: true bmc_fw_update_job_wait: description: Whether to wait for job completion or not. type: bool diff --git a/roles/bmc_fw_update/tasks/main.yml b/roles/bmc_fw_update/tasks/main.yml index 0a0d4e1..f56c8f0 100644 --- a/roles/bmc_fw_update/tasks/main.yml +++ b/roles/bmc_fw_update/tasks/main.yml @@ -13,10 +13,10 @@ ansible.builtin.debug: msg: "{{ bmc_firmware_version }}" -- name: Download firmware image {{ bmc_fw_update_image.bmc }} +- name: Download firmware image {{ bmc_fw_update_image_url }} ansible.builtin.get_url: - url: "{{ bmc_fw_update_image.url }}/{{ bmc_fw_update_image.bmc }}" - dest: /tmp/{{ bmc_fw_update_image.bmc }} + url: "{{ bmc_fw_update_image_url }}" + dest: "{{ bmc_fw_update_image_file }}" mode: '0440' delegate_to: localhost @@ -28,7 +28,7 @@ username: "{{ dpu_bmc_username }}" password: "{{ dpu_bmc_password }}" timeout: 600 - update_image_file: "/tmp/{{ bmc_fw_update_image.bmc }}" + update_image_file: "{{ bmc_fw_update_image_file }}" register: result_update_task delegate_to: localhost diff --git a/roles/bmc_fw_update/vars/main.yml b/roles/bmc_fw_update/vars/main.yml index 41c41fa..feec870 100644 --- a/roles/bmc_fw_update/vars/main.yml +++ b/roles/bmc_fw_update/vars/main.yml @@ -5,7 +5,3 @@ # vars file for bmc_fw_update bmc_fw_update_task_failure: "Task failed with status: %s" -bmc_fw_update_image: - 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