From 02616ec6b3afe92a0aafdc2f9a088725ea1c1e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryan=20BADA=C3=8F?= <43403063+ryanb74@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:44:43 +0100 Subject: [PATCH 1/2] fix: fix hpilo_boot.py module failing when trying to power on an already powered-on server For this module to be idempotent, it should be successful when trying to reach a power state which is already there. It was already the case for "poweroff", however when running the module with "boot_once" state, it was failing if the server was already powered_on, which is not an idempotent behavior --- plugins/modules/hpilo_boot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/modules/hpilo_boot.py b/plugins/modules/hpilo_boot.py index ecef60f66a2..b49a76ad32f 100644 --- a/plugins/modules/hpilo_boot.py +++ b/plugins/modules/hpilo_boot.py @@ -188,9 +188,8 @@ def main(): power_status = ilo.get_host_power_status() if not force and power_status == 'ON': - module.fail_json(msg='HP iLO (%s) reports that the server is already powered on !' % host) - - if power_status == 'ON': + pass + elif power_status == 'ON': ilo.warm_boot_server() # ilo.cold_boot_server() changed = True From 2fcdc39ddc5fc2de9fe8e892a5936556b534b04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryan=20BADA=C3=8F?= <43403063+ryanb74@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:37:51 +0100 Subject: [PATCH 2/2] doc: Add changelog fragment --- changelogs/fragments/9646-hpilo-fix-idempotency.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/9646-hpilo-fix-idempotency.yml diff --git a/changelogs/fragments/9646-hpilo-fix-idempotency.yml b/changelogs/fragments/9646-hpilo-fix-idempotency.yml new file mode 100644 index 00000000000..099cb84f8eb --- /dev/null +++ b/changelogs/fragments/9646-hpilo-fix-idempotency.yml @@ -0,0 +1,2 @@ +minor_changes: + - "hpilo_boot - Fix module failing when trying to power on an already powered-on server (idempotency issue) (https://github.com/ansible-collections/community.general/pull/9646)." \ No newline at end of file