3
0
forked from jakub/ansible
This commit is contained in:
martin.fencl
2025-12-10 12:31:17 +01:00
parent a1d730a18c
commit c2d67f5498

View File

@@ -60,7 +60,7 @@
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- sshpass - sshpass
- -e # read password from SSHPASS environment - -e
- ssh - ssh
- -o - -o
- StrictHostKeyChecking=no - StrictHostKeyChecking=no
@@ -71,14 +71,15 @@
- -lc - -lc
- "{{ ('sudo ' if use_sudo else '') + item }}" - "{{ ('sudo ' if use_sudo else '') + item }}"
environment: environment:
SSHPASS: "{{ vm_pass }}" # supply password via environment SSHPASS: "{{ vm_pass }}"
loop: "{{ immich_commands }}" loop: "{{ immich_commands }}"
loop_control: loop_control:
index_var: idx # capture loop index index_var: idx
label: "cmd-{{ idx }}" # avoid printing full command in (item=...) line label: "cmd-{{ idx }}"
register: immich_cmds register: immich_cmds
changed_when: false changed_when: false
no_log: "{{ DEBUG == 0 }}" # hide outputs and env when not debugging no_log: "{{ DEBUG == 0 }}"
run_once: true # <<< přidat
- name: Show outputs for each Immich command - name: Show outputs for each Immich command
ansible.builtin.debug: ansible.builtin.debug:
@@ -92,7 +93,7 @@
loop: "{{ immich_cmds.results }}" loop: "{{ immich_cmds.results }}"
when: DEBUG == 1 when: DEBUG == 1
- name: Fail play if any Immich command failed # also hide item label - name: Fail play if any Immich command failed
ansible.builtin.assert: ansible.builtin.assert:
that: "item.rc == 0" that: "item.rc == 0"
fail_msg: "Immich update failed on VM: {{ item.item }} (rc={{ item.rc }})" fail_msg: "Immich update failed on VM: {{ item.item }} (rc={{ item.rc }})"
@@ -101,6 +102,7 @@
loop_control: loop_control:
index_var: idx index_var: idx
label: "cmd-{{ idx }}" label: "cmd-{{ idx }}"
run_once: true
# ------------------------- # -------------------------
# Readiness checks (controller first, then VM fallback) # Readiness checks (controller first, then VM fallback)