From 46d44ae924ecb233f7e299fa8c4dd3af8553465c Mon Sep 17 00:00:00 2001 From: "martin.fencl" Date: Mon, 24 Nov 2025 22:23:28 +0100 Subject: [PATCH] Add assertion to check Immich controller URL reachability and update task failure handling --- update_immich.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/update_immich.yml b/update_immich.yml index 15b66ca..44594a0 100644 --- a/update_immich.yml +++ b/update_immich.yml @@ -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."