3
0
forked from jakub/ansible
This commit is contained in:
martin.fencl
2025-12-10 11:12:03 +01:00
parent d94f999f7b
commit 4f39d04e3f

View File

@@ -41,14 +41,18 @@
docker_prefix: "unalias docker 2>/dev/null || true; DOCKER_CLI_HINTS=0; command docker"
# Commands to run on the target VM (quiet outputs)
# 1) Ensure compose dir exists
# 1) Check directory exists (we do NOT create anything, to stay safe)
# 2) Safely download latest docker-compose.yml from GitHub (with backup)
# 3) Pull images according to compose
# 4) Start / update stack
immich_commands:
- "mkdir -p {{ immich_compose_dir }}"
- >-
cd {{ immich_compose_dir }} &&
if [ ! -d '{{ immich_compose_dir }}' ]; then
echo 'ERROR: Directory {{ immich_compose_dir }} does not exist on VM; not touching anything.' >&2;
exit 1;
fi
- >-
cd '{{ immich_compose_dir }}' &&
wget -qO docker-compose.yml.new "{{ immich_compose_url }}" || true;
if [ -s docker-compose.yml.new ]; then
echo 'Downloaded new docker-compose.yml from GitHub (Immich latest).';
@@ -61,9 +65,9 @@
echo 'WARNING: Failed to download a valid docker-compose.yml, keeping existing one.' >&2;
rm -f docker-compose.yml.new 2>/dev/null || true;
fi
- "{{ docker_prefix }} compose -p {{ immich_project }} -f {{ immich_compose_file }} pull >/dev/null"
- "{{ docker_prefix }} compose -p {{ immich_project }} -f {{ immich_compose_file }} up -d --remove-orphans >/dev/null"
- "{{ docker_prefix }} compose -p_
tasks:
- name: Ensure sshpass is installed (for password-based SSH) # English comments
ansible.builtin.apt: