homelab/roles/immich/tasks/main.yml

68 lines
1.8 KiB
YAML
Raw Normal View History

2024-10-30 11:08:12 +05:00
---
- 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"
- name: Start immich server container
become: true
community.docker.docker_container:
name: immich-1
image: ghcr.io/immich-app/immich-server:{{ 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
networks:
- name: haproxy
- name: immich
- name: postgresql
recreate: "{{ cfg.changed }}"
2024-10-30 17:55:20 +05:00
restart_policy: unless-stopped
2024-10-30 11:08:12 +05:00
- 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 }}"
2024-10-30 17:55:20 +05:00
restart_policy: unless-stopped