homelab/roles/immich/tasks/main.yml
Ivan Reshetnikov d3b27d3565
Disable server in haproxy before updating
This will reduce the number of errors for users.
The experiments were carried out on immich, it is not so important.
2024-11-28 12:41:38 +05:00

55 lines
1.4 KiB
YAML

---
- name: Create root-owned immich config dir
become: true
ansible.builtin.file:
path: /etc/immich
state: directory
mode: "1700"
owner: root
- name: Create nested immich config dir
become: true
ansible.builtin.file:
path: /etc/immich/_data
state: directory
mode: "1755"
owner: root
- name: Copy config files
become: true
ansible.builtin.template:
src: "{{ item }}.j2"
dest: /etc/immich/_data/{{ item }}
loop: ["immich.env", "immich.json"]
register: cfg
- name: Start redis container
include_role:
name: redis
vars:
preset: persistent
container_name: immich-redis
docker_networks:
- name: immich
docker_volume: immich-redis
- name: Create immich volumes
become: true
community.docker.docker_volume:
name: "immich-model-cache"
- include_tasks: start_server.yml
loop: [1]
loop_control:
loop_var: server_idx
- name: Start immich machine learning container
become: true
community.docker.docker_container:
name: immich-machine-learning-1
image: ghcr.io/immich-app/immich-machine-learning:{{ tag }}
env_file: /etc/immich/_data/immich.env
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/hdd/immich:/usr/src/app/upload
- /etc/immich/_data:/etc/immich
- immich-model-cache:/cache
networks:
- name: immich
- name: postgresql
recreate: "{{ cfg.changed }}"
restart_policy: unless-stopped