Replace docker rclone volumes with native cifs volumes

This commit is contained in:
Tobias Reisinger 2026-01-25 12:22:18 +01:00
parent 85568c8278
commit 635a0c4da8
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
12 changed files with 19 additions and 106 deletions

View file

@ -149,7 +149,7 @@ resource "hcloud_storage_box_subaccount" "service_accounts" {
access_settings = { access_settings = {
reachable_externally = true reachable_externally = true
webdav_enabled = true samba_enabled = true
} }
description = each.key description = each.key

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
backup_path="$1"
stage="$2"
if [ "$stage" == "before" ]; then
rclone mount --config /opt/services/backup/rclone.conf --daemon immich_upload: "$backup_path"
fi
if [ "$stage" == "after" ]; then
unmount "$backup_path"
fi

View file

@ -25,12 +25,6 @@
content: '{{ backup_yml_all | to_nice_yaml }}' content: '{{ backup_yml_all | to_nice_yaml }}'
mode: "0644" mode: "0644"
- name: Create rclone.conf
ansible.builtin.copy:
dest: "{{ (service_path, 'rclone.conf') | path_join }}"
content: '{{ vault_backup.rclone }}'
mode: "0600"
- name: Import tasks specific to the hooks scripts - name: Import tasks specific to the hooks scripts
ansible.builtin.import_tasks: hooks.yml ansible.builtin.import_tasks: hooks.yml
- name: Import tasks specific to the recovery scripts - name: Import tasks specific to the recovery scripts

View file

@ -15,9 +15,12 @@ calibre_web_compose:
image: lscr.io/linuxserver/calibre-web:latest image: lscr.io/linuxserver/calibre-web:latest
volumes: volumes:
- config:/config - config:/config
- calibre_web_data:/data - data:/data
file: file:
volumes: volumes:
config: config:
calibre_web_data: data:
external: true driver_opts:
type: cifs
o: "username={{ opentofu.hcloud_storage_box_accounts.calibre_web.user }},password={{ opentofu.hcloud_storage_box_accounts.calibre_web.pass }}"
device: "//{{ opentofu.hcloud_storage_box_accounts.calibre_web.host }}/{{ opentofu.hcloud_storage_box_accounts.calibre_web.user }}"

View file

@ -8,10 +8,5 @@
env: "{{ calibre_web_env }}" env: "{{ calibre_web_env }}"
compose: "{{ calibre_web_compose }}" compose: "{{ calibre_web_compose }}"
block: block:
- name: Import tasks to create docker rclone volume
ansible.builtin.import_tasks: tasks/create-docker-rclone-volume.yml
vars:
task_volume: calibre_web_data
task_rclone: "{{ opentofu.hcloud_storage_box_accounts.calibre_web }}"
- name: Import tasks to deploy common service - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -29,7 +29,7 @@ immich_compose:
watchtower: monitor watchtower: monitor
image: ghcr.io/immich-app/immich-server:{{ immich_docker_tag }} image: ghcr.io/immich-app/immich-server:{{ immich_docker_tag }}
volumes: volumes:
- immich_upload:/usr/src/app/upload - upload:/usr/src/app/upload
file: file:
services: services:
app: app:
@ -50,7 +50,7 @@ immich_compose:
cpus: 1.0 cpus: 1.0
mem_limit: 1g mem_limit: 1g
volumes: volumes:
- immich_upload:/usr/src/app/upload - upload:/usr/src/app/upload
restart: always restart: always
networks: networks:
default: default:
@ -96,7 +96,10 @@ immich_compose:
default: default:
volumes: volumes:
immich_upload: upload:
external: true driver_opts:
type: cifs
o: "username={{ opentofu.hcloud_storage_box_accounts.immich.user }},password={{ opentofu.hcloud_storage_box_accounts.immich.pass }}"
device: "//{{ opentofu.hcloud_storage_box_accounts.immich.host }}/{{ opentofu.hcloud_storage_box_accounts.immich.user }}"
pgdata: pgdata:
model-cache: model-cache:

View file

@ -8,10 +8,5 @@
env: "{{ immich_env }}" env: "{{ immich_env }}"
compose: "{{ immich_compose }}" compose: "{{ immich_compose }}"
block: block:
- name: Import tasks to create docker rclone volume
ansible.builtin.import_tasks: tasks/create-docker-rclone-volume.yml
vars:
task_volume: immich_upload
task_rclone: "{{ opentofu.hcloud_storage_box_accounts.immich }}"
- name: Import tasks to deploy common service - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -47,15 +47,9 @@ immich_worker_compose:
volumes: volumes:
upload: upload:
driver: rclone
driver_opts: driver_opts:
type: sftp type: cifs
sftp_host: "{{ opentofu.hcloud_storage_box_accounts.immich.host }}" o: "username={{ opentofu.hcloud_storage_box_accounts.immich.user }},password={{ opentofu.hcloud_storage_box_accounts.immich.pass }}"
sftp_port: 23 device: "//{{ opentofu.hcloud_storage_box_accounts.immich.host }}/{{ opentofu.hcloud_storage_box_accounts.immich.user }}"
sftp_user: "{{ opentofu.hcloud_storage_box_accounts.immich.user }}"
sftp_pass: "{{ opentofu.hcloud_storage_box_accounts.immich.pass_obscure }}"
allow_other: 'true'
vfs_cache_mode: minimal
poll_interval: 0
pgdata: pgdata:
model-cache: model-cache:

View file

@ -1,29 +0,0 @@
- name: Install fuse system packages
ansible.builtin.apt:
pkg:
- fuse
state: present
update_cache: true
become: true
- name: Create the rclone plugin config dir
ansible.builtin.file:
path: "/var/lib/docker-plugins/rclone/config"
state: directory
mode: "0755"
become: true
- name: Create the rclone plugin cache dir
ansible.builtin.file:
path: "/var/lib/docker-plugins/rclone/cache"
state: directory
mode: "0755"
become: true
- name: Install rclone plugin
community.docker.docker_plugin:
alias: rclone
plugin_name: rclone/docker-volume-rclone:amd64
plugin_options:
args: "-v"
state: enable

View file

@ -3,7 +3,6 @@
pkg: pkg:
- bzip2 - bzip2
- jq - jq
- rclone
- zsh - zsh
state: present state: present
update_cache: true update_cache: true
@ -11,8 +10,6 @@
- name: Install docker - name: Install docker
ansible.builtin.import_tasks: docker.yml ansible.builtin.import_tasks: docker.yml
- name: Install docker rclone plugin
ansible.builtin.import_tasks: docker-rclone-plugin.yml
- name: Install (auto-)restic - name: Install (auto-)restic
ansible.builtin.import_tasks: restic.yml ansible.builtin.import_tasks: restic.yml
- name: Install systemd-resolved - name: Install systemd-resolved

View file

@ -1,27 +0,0 @@
- name: Get infos on volume
community.docker.docker_volume_info:
name: "{{ task_volume }}"
register: res_docker_volume
- name: Create volume (block)
when: not res_docker_volume.exists
block:
- name: Obscure rclone password
ansible.builtin.command:
cmd: rclone obscure -
stdin: "{{ task_rclone.pass }}"
register: res_rclone_pass
delegate_to: localhost
changed_when: true
- name: Create volume
community.docker.docker_volume:
name: "{{ task_volume }}"
driver: rclone
driver_options:
type: webdav
webdav_url: "https://{{ task_rclone.host }}"
webdav_user: "{{ task_rclone.user }}"
webdav_pass: "{{ res_rclone_pass.stdout }}"
vfs_cache_mode: minimal
allow_other: 'true'

View file

@ -93,7 +93,7 @@ services = {
}, },
{ {
name = "calibre_web_data" name = "calibre_web_data"
type = "hook" type = "docker"
} }
] ]
monitoring = { monitoring = {
@ -307,7 +307,7 @@ services = {
backup = [ backup = [
{ {
name = "immich_upload" name = "immich_upload"
type = "hook" type = "docker"
}, },
{ {
name = "immich_database" name = "immich_database"