Skip to content

Commit

Permalink
fix(bmc_fw_update): move vars to argument_specs
Browse files Browse the repository at this point in the history
Fixed #37

Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Feb 29, 2024
1 parent 5b38fca commit 6c7a49d
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 10 deletions.
82 changes: 82 additions & 0 deletions docs/bmc_fw_update_role.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,88 @@ Parameters
* - Parameter
- Comments

* - .. raw:: html

<div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-main--bmc_fw_update_image_file"></div>

.. _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

<a class="ansibleOptionLink" href="#parameter-main--bmc_fw_update_image_file" title="Permalink to this option"></a>

.. ansible-option-type-line::

:ansible-option-type:`string`




.. raw:: html

</div>

- .. raw:: html

<div class="ansible-option-cell">

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

</div>

* - .. raw:: html

<div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-main--bmc_fw_update_image_url"></div>

.. _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

<a class="ansibleOptionLink" href="#parameter-main--bmc_fw_update_image_url" title="Permalink to this option"></a>

.. ansible-option-type-line::

:ansible-option-type:`string`




.. raw:: html

</div>

- .. raw:: html

<div class="ansible-option-cell">

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

</div>

* - .. raw:: html

<div class="ansible-option-cell">
Expand Down
2 changes: 2 additions & 0 deletions roles/bmc_fw_update/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions roles/bmc_fw_update/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions roles/bmc_fw_update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 0 additions & 4 deletions roles/bmc_fw_update/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6c7a49d

Please sign in to comment.