From 6c7a49dcd4dd58ecc01ff47173d200ecf9c120f9 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 | 12 +-- roles/bmc_fw_update/vars/main.yml | 4 - 5 files changed, 100 insertions(+), 10 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 b6b53f8..26a8a06 100644 --- a/roles/bmc_fw_update/tasks/main.yml +++ b/roles/bmc_fw_update/tasks/main.yml @@ -13,16 +13,16 @@ ansible.builtin.debug: msg: "{{ bmc_firmware_version }}" -- name: Check if firmware image exists locally {{ bmc_fw_update_image.bmc }} +- name: Check if firmware image exists locally {{ bmc_fw_update_image_file }} ansible.builtin.stat: - path: "{{ bmc_fw_update_image.dir }}/{{ bmc_fw_update_image.bmc }}" + path: "{{ bmc_fw_update_image_file }}" delegate_to: localhost register: bmc_fw_update_local_file_check -- 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: "{{ bmc_fw_update_image.dir }}" + url: "{{ bmc_fw_update_image_url }}" + dest: "{{ bmc_fw_update_image_file }}" mode: '0440' delegate_to: localhost when: not bmc_fw_update_local_file_check.stat.exists @@ -35,7 +35,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 b8498fc..7ae8f9f 100644 --- a/roles/bmc_fw_update/vars/main.yml +++ b/roles/bmc_fw_update/vars/main.yml @@ -6,7 +6,3 @@ bmc_fw_update_task_failure: "Task failed with status: %s" bmc_fw_update_version_failure: "Version returned from BMC doesn't match version in the file name" -bmc_fw_update_image: - url: https://content.mellanox.com/BlueField/BMC/23.10-1-oct-2023 - bmc: bf3-bmc-23.10-5_opn.fwpkg - dir: /tmp