backups: archive volumes > copy to localhost > rm remote > extract in local

This commit is contained in:
2025-08-20 22:14:41 +10:00
parent 4f682e449f
commit 064b6dd7b5
3 changed files with 41 additions and 13 deletions

View File

@@ -1,17 +1,40 @@
---
- name: Backup Docker volumes from remote server
hosts: all
# become: yes
tasks:
- name: Ensure local backup directory exists
local_action: file
path=./backups
state=directory
mode=0755
become: yes
vars:
backup_dir: "./backups"
backup_name: "volumes_{{ ansible_date_time.iso8601_basic_short }}"
archive_path: "/tmp/docker_volumes_backup_{{ ansible_date_time.iso8601_basic_short }}.tar.gz"
- name: Synchronize /var/lib/docker/volumes to local ./backups
synchronize:
src: /var/lib/docker/volumes
tasks:
- name: Create archive of docker volumes
become: yes
archive:
path: /opt/docker/.
dest: /tmp/{{ backup_name }}.tar.gz
format: gz
- name: Fetch archive to local machine
become: yes
fetch:
src: /tmp/{{ backup_name }}.tar.gz
dest: ./backups/archive/
flat: yes
- name: Clean up archive on remote
become: yes
file:
path: /tmp/{{ backup_name }}.tar.gz
state: absent
- name: Extract archive locally
become: no
delegate_to: localhost
run_once: true
ansible.builtin.unarchive:
src: ./backups/archive/{{ backup_name }}.tar.gz
dest: ./backups/
mode: pull
delete: no
remote_src: no
# extra_opts: [ "--strip-components=3" ]

5
costil-fast-fix-plz.sh Normal file
View File

@@ -0,0 +1,5 @@
1. fix synapse/data/homeserver.yaml -> media_store_path: /data/media_store
2. sudo docker exec -it matrix_synapse /bin/bash
3. chown -R 911:911 /media
4. mv data/media_store/ media/
5. restore synapse/data/homeserver.yaml -> media_store_path: /media/media_store

View File

@@ -100,7 +100,7 @@ services:
ports:
- "51820:51820/udp"
volumes:
- wireguard_data:/config
- ./wireguard/config:/config
restart: unless-stopped
volumes: