3
0
forked from jakub/ansible

Add assertion to check Immich controller URL reachability and update task failure handling

This commit is contained in:
martin.fencl
2025-11-24 22:23:28 +01:00
parent e1474fd587
commit 46d44ae924

View File

@@ -111,7 +111,7 @@
retries: "{{ immich_retries }}"
delay: "{{ immich_delay }}"
until: immich_controller.status == 200
failed_when: false
failed_when: false # allow task to finish without failing the play
changed_when: false
- name: Immich | VM-side fetch (HTML via Python, with retries) # use SSHPASS env here too
@@ -184,3 +184,20 @@
ansible.builtin.debug:
msg: "{{ (immich_home_html | default(''))[:500] }}"
when: immich_home_html is defined and DEBUG == 1
# -------------------------
# Final assertion: controller URL must be reachable
# -------------------------
- name: Immich | Assert controller URL reachable (if configured)
ansible.builtin.assert:
that:
- >
not (immich_url is defined and (immich_url | length) > 0)
or
(
immich_controller is defined
and (immich_controller.status | default(0)) == 200
)
fail_msg: "Immich controller URL {{ immich_url }} is NOT reachable with HTTP 200 after retries."
success_msg: "Immich controller URL {{ immich_url }} is reachable with HTTP 200."