forked from jakub/ansible
Add assertion to check Immich controller URL reachability and update task failure handling
This commit is contained in:
@@ -111,7 +111,7 @@
|
|||||||
retries: "{{ immich_retries }}"
|
retries: "{{ immich_retries }}"
|
||||||
delay: "{{ immich_delay }}"
|
delay: "{{ immich_delay }}"
|
||||||
until: immich_controller.status == 200
|
until: immich_controller.status == 200
|
||||||
failed_when: false
|
failed_when: false # allow task to finish without failing the play
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Immich | VM-side fetch (HTML via Python, with retries) # use SSHPASS env here too
|
- name: Immich | VM-side fetch (HTML via Python, with retries) # use SSHPASS env here too
|
||||||
@@ -184,3 +184,20 @@
|
|||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ (immich_home_html | default(''))[:500] }}"
|
msg: "{{ (immich_home_html | default(''))[:500] }}"
|
||||||
when: immich_home_html is defined and DEBUG == 1
|
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."
|
||||||
|
|||||||
Reference in New Issue
Block a user