From d413dcb29fd5791a6641ad8ef3fa1e2149a84099 Mon Sep 17 00:00:00 2001 From: "martin.fencl" Date: Tue, 23 Dec 2025 23:12:42 +0100 Subject: [PATCH] redo --- check_raid.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/check_raid.yml b/check_raid.yml index 30754aa..9b380ac 100644 --- a/check_raid.yml +++ b/check_raid.yml @@ -120,26 +120,26 @@ retries: "{{ raid_retries }}" delay: "{{ raid_delay }}" # Retry only on typical SSH/timeout failures (255=ssh error, 124=timeout) - until: (raid_cmds.results | selectattr('rc', 'in', [124, 255]) | list | length) == 0 + until: raid_cmds.rc not in [124, 255] - name: Show outputs for each RAID command ansible.builtin.debug: msg: | - CMD: {{ item.item }} + CMD: {{ item.item | default('n/a') }} RC: {{ item.rc }} STDOUT: {{ (item.stdout | default('')).strip() }} STDERR: {{ (item.stderr | default('')).strip() }} - loop: "{{ raid_cmds.results }}" + loop: "{{ (raid_cmds.results if (raid_cmds.results is defined) else [raid_cmds]) }}" when: DEBUG == 1 - name: Fail play if RAID check failed # English comments ansible.builtin.assert: that: "item.rc == 0" - fail_msg: "RAID check failed on VM: {{ item.stdout | default(item.stderr) | default('no output') }}" + fail_msg: "RAID check failed on VM: {{ (item.stdout | default(item.stderr) | default('no output')) | trim }}" success_msg: "RAID check OK." - loop: "{{ raid_cmds.results }}" + loop: "{{ (raid_cmds.results if (raid_cmds.results is defined) else [raid_cmds]) }}" loop_control: index_var: idx label: "cmd-{{ idx }}"