From 7070c739b97c1e73207eaa84f1e65e3bd12f01de Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 16 Oct 2025 15:50:45 +0000 Subject: [PATCH] Update 6 files - /group_vars/all.yml - /roles/immich/templates/.env.j2 - /roles/immich/templates/docker-compose.yml.j2 - /roles/immich/tasks/main.yml - /inventories/hosts - /olimp-deploy.yml --- group_vars/all.yml | 14 +++++- inventories/hosts | 4 ++ olimp-deploy.yml | 6 +++ roles/immich/tasks/main.yml | 42 ++++++++++++++++ roles/immich/templates/.env.j2 | 22 ++++++++ roles/immich/templates/docker-compose.yml.j2 | 53 ++++++++++++++++++++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 roles/immich/tasks/main.yml create mode 100644 roles/immich/templates/.env.j2 create mode 100644 roles/immich/templates/docker-compose.yml.j2 diff --git a/group_vars/all.yml b/group_vars/all.yml index 6d63665..52e771e 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -113,4 +113,16 @@ mumble_port: "45131" mumble_ice_port: "6502" mumble_server_password: "passw0rd" mumble_superuser_password: "13qeadZC" -mumble_max_users: "100" \ No newline at end of file +mumble_max_users: "100" + +# ------------192.168.1.206 talk------------ + + +# Immich variables +immich_base_dir: "/mnt/service/immich" +immich_port: "45135" +immich_db_username: "postgres" +immich_db_password: "postgres" +immich_db_name: "immich" +immich_version: "release" +# immich_public_url: "https://photos.yourdomain.com" # раскомментирую если нужно \ No newline at end of file diff --git a/inventories/hosts b/inventories/hosts index 8e64d42..d9982ee 100644 --- a/inventories/hosts +++ b/inventories/hosts @@ -2,6 +2,7 @@ gateway ansible_host=192.168.1.201 int_ip=192.168.1.201 data ansible_host=192.168.1.222 int_ip=192.168.1.222 media ansible_host=192.168.1.223 int_ip=192.168.1.223 +photo ansible_host=192.168.1.224 int_ip=192.168.1.224 talk ansible_host=192.168.1.226 int_ip=192.168.1.226 [gateway] @@ -13,5 +14,8 @@ data [media] media +[photo] +photo + [talk] talk \ No newline at end of file diff --git a/olimp-deploy.yml b/olimp-deploy.yml index f9a903c..b519945 100644 --- a/olimp-deploy.yml +++ b/olimp-deploy.yml @@ -15,12 +15,18 @@ - { role: mealie, tags: deploy_mealie } - { role: bookstack, tags: deploy_bookstack } - { role: bitwarden, tags: deploy_bitwarden } + - hosts: media roles: - { role: docker, tags: deploy_docker } - { role: ampache, tags: deploy_ampache } - { role: audiobookshelf, tags: deploy_audiobookshelf } +- hosts: photo + roles: + - { role: docker, tags: deploy_docker } + - { role: immich, tags: deploy_immich } + - hosts: talk roles: - { role: docker, tags: deploy_docker } diff --git a/roles/immich/tasks/main.yml b/roles/immich/tasks/main.yml new file mode 100644 index 0000000..218f499 --- /dev/null +++ b/roles/immich/tasks/main.yml @@ -0,0 +1,42 @@ +--- +- name: Create Immich directories + file: + path: "{{ item }}" + state: directory + mode: 0755 + loop: + - "{{ immich_base_dir }}" + - /mnt/immich/postgres + - /mnt/immich_upload + +- name: Deploy Immich docker-compose.yml + template: + src: docker-compose.yml.j2 + dest: "{{ immich_base_dir }}/docker-compose.yml" + mode: 0644 + +- name: Deploy Immich .env file + template: + src: .env.j2 + dest: "{{ immich_base_dir }}/.env" + mode: 0644 + +- name: Start Immich services + shell: | + cd {{ immich_base_dir }} + docker compose up -d + args: + executable: /bin/bash + +- name: Wait for services to start + pause: + seconds: 30 + +- name: Check Immich container status + shell: docker ps --filter name=immich + register: immich_status + changed_when: false + +- name: Show Immich status + debug: + var: immich_status.stdout \ No newline at end of file diff --git a/roles/immich/templates/.env.j2 b/roles/immich/templates/.env.j2 new file mode 100644 index 0000000..5f536e9 --- /dev/null +++ b/roles/immich/templates/.env.j2 @@ -0,0 +1,22 @@ +# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables + +# The location where your uploaded files are stored +UPLOAD_LOCATION=/mnt/immich_upload + +# The location where your database files are stored. Network shares are not supported for the database +DB_DATA_LOCATION=/mnt/immich/postgres + +# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List +TZ={{ timezone }} + +# The Immich version to use. You can pin this to a specific version like "v1.71.0" +IMMICH_VERSION={{ immich_version }} + +# Connection secret for postgres. You should change it to a random password +# Please use only the characters `A-Za-z0-9`, without special characters or spaces +DB_PASSWORD={{ immich_db_password }} + +# The values below this line do not need to be changed +################################################################################### +DB_USERNAME={{ immich_db_username }} +DB_DATABASE_NAME={{ immich_db_name }} \ No newline at end of file diff --git a/roles/immich/templates/docker-compose.yml.j2 b/roles/immich/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..ef61dfe --- /dev/null +++ b/roles/immich/templates/docker-compose.yml.j2 @@ -0,0 +1,53 @@ +name: immich + +services: + immich-server: + container_name: immich_server + image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} + volumes: + - ${UPLOAD_LOCATION}:/data + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + ports: + - '{{ immich_port }}:2283' + depends_on: + - redis + - database + restart: always + healthcheck: + disable: false + + immich-machine-learning: + container_name: immich_machine_learning + image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} + volumes: + - model-cache:/cache + env_file: + - .env + restart: always + healthcheck: + disable: false + + redis: + container_name: immich_redis + image: docker.io/valkey/valkey:8-bookworm@sha256:a137a2b60aca1a75130022d6bb96af423fefae4eb55faf395732db3544803280 + healthcheck: + test: redis-cli ping || exit 1 + restart: always + + database: + container_name: immich_postgres + image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_USER: ${DB_USERNAME} + POSTGRES_DB: ${DB_DATABASE_NAME} + POSTGRES_INITDB_ARGS: '--data-checksums' + volumes: + - ${DB_DATA_LOCATION}:/var/lib/postgresql/data + shm_size: 128mb + restart: always + +volumes: + model-cache: \ No newline at end of file