From b80cd098a9ad812f624a1e2de33152bce2c5eb46 Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Thu, 22 Feb 2024 22:29:21 +0200 Subject: [PATCH] feat(bmc): add bmc_reboot_should_wait argument Signed-off-by: Boris Glimcher --- docs/bmc_reboot_role.rst | 86 ++++++++++++++++++++++++ galaxy.yml | 2 +- roles/bmc_reboot/defaults/main.yml | 2 + roles/bmc_reboot/meta/argument_specs.yml | 10 +++ roles/bmc_reboot/tasks/main.yml | 12 ++-- 5 files changed, 103 insertions(+), 9 deletions(-) diff --git a/docs/bmc_reboot_role.rst b/docs/bmc_reboot_role.rst index 1fbc463..f93b38b 100644 --- a/docs/bmc_reboot_role.rst +++ b/docs/bmc_reboot_role.rst @@ -108,6 +108,92 @@ Parameters Security token for authentication with DPU BMC. + .. raw:: html + + + + * - .. raw:: html + +
+
+ + .. _ansible_collections.opiproject.dpu.bmc_reboot_role__parameter-main__bmc_reboot_should_wait: + + .. rst-class:: ansible-option-title + + **bmc_reboot_should_wait** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`boolean` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Wait for the BMC to restart. + + + .. rst-class:: ansible-option-line + + :ansible-option-choices:`Choices:` + + - :ansible-option-choices-entry:`false` + - :ansible-option-choices-entry-default:`true` :ansible-option-choices-default-mark:`← (default)` + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.opiproject.dpu.bmc_reboot_role__parameter-main__bmc_reboot_wait_timeout: + + .. rst-class:: ansible-option-title + + **bmc_reboot_wait_timeout** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-type:`integer` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Seconds to wait for the BMC to restart. + + + .. rst-class:: ansible-option-line + + :ansible-option-default-bold:`Default:` :ansible-option-default:`120` + .. raw:: html
diff --git a/galaxy.yml b/galaxy.yml index 45e4877..f5d7780 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -42,7 +42,7 @@ tags: [opi, dpu, redfish, automation, devops, infrastructure] # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' dependencies: { - "community.general": ">=8.6.0", + "community.general": ">=9.1.0", } # The URL of the originating SCM repository diff --git a/roles/bmc_reboot/defaults/main.yml b/roles/bmc_reboot/defaults/main.yml index 97b1a9d..9eda6a5 100644 --- a/roles/bmc_reboot/defaults/main.yml +++ b/roles/bmc_reboot/defaults/main.yml @@ -5,3 +5,5 @@ # defaults file for bmc_reboot https_port: 443 +bmc_reboot_should_wait: true +bmc_reboot_wait_timeout: 120 diff --git a/roles/bmc_reboot/meta/argument_specs.yml b/roles/bmc_reboot/meta/argument_specs.yml index 7139f5b..e6d2e7b 100644 --- a/roles/bmc_reboot/meta/argument_specs.yml +++ b/roles/bmc_reboot/meta/argument_specs.yml @@ -29,3 +29,13 @@ argument_specs: description: - DPU BMC port. default: 443 + bmc_reboot_should_wait: + description: + - Wait for the BMC to restart. + type: bool + default: true + bmc_reboot_wait_timeout: + description: + - Seconds to wait for the BMC to restart. + type: int + default: 120 diff --git a/roles/bmc_reboot/tasks/main.yml b/roles/bmc_reboot/tasks/main.yml index f624afd..e874f52 100644 --- a/roles/bmc_reboot/tasks/main.yml +++ b/roles/bmc_reboot/tasks/main.yml @@ -28,10 +28,8 @@ baseuri: "{{ inventory_hostname }}" username: "{{ dpu_bmc_username }}" password: "{{ dpu_bmc_password }}" - - - name: Pause for 60 seconds for BMC to Reboot - ansible.builtin.pause: - seconds: 60 + wait: "{{ bmc_reboot_should_wait }}" + wait_timeout: "{{ bmc_reboot_wait_timeout }}" - name: Reboot BMC when auth_token is defined when: dpu_bmc_token is defined @@ -44,7 +42,5 @@ timeout: 60 baseuri: "{{ inventory_hostname }}" auth_token: "{{ dpu_bmc_token }}" - - - name: Pause for 60 seconds for BMC to Reboot - ansible.builtin.pause: - seconds: 60 + wait: "{{ bmc_reboot_should_wait }}" + wait_timeout: "{{ bmc_reboot_wait_timeout }}"