backups: archive volumes > copy to localhost > rm remote > extract in local
This commit is contained in:
@@ -1,17 +1,40 @@
|
|||||||
---
|
---
|
||||||
- name: Backup Docker volumes from remote server
|
- name: Backup Docker volumes from remote server
|
||||||
hosts: all
|
hosts: all
|
||||||
# become: yes
|
become: yes
|
||||||
tasks:
|
vars:
|
||||||
- name: Ensure local backup directory exists
|
backup_dir: "./backups"
|
||||||
local_action: file
|
backup_name: "volumes_{{ ansible_date_time.iso8601_basic_short }}"
|
||||||
path=./backups
|
archive_path: "/tmp/docker_volumes_backup_{{ ansible_date_time.iso8601_basic_short }}.tar.gz"
|
||||||
state=directory
|
|
||||||
mode=0755
|
|
||||||
|
|
||||||
- name: Synchronize /var/lib/docker/volumes to local ./backups
|
|
||||||
synchronize:
|
tasks:
|
||||||
src: /var/lib/docker/volumes
|
- 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/
|
dest: ./backups/
|
||||||
mode: pull
|
remote_src: no
|
||||||
delete: no
|
# extra_opts: [ "--strip-components=3" ]
|
||||||
|
|||||||
5
costil-fast-fix-plz.sh
Normal file
5
costil-fast-fix-plz.sh
Normal 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
|
||||||
@@ -100,7 +100,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "51820:51820/udp"
|
- "51820:51820/udp"
|
||||||
volumes:
|
volumes:
|
||||||
- wireguard_data:/config
|
- ./wireguard/config:/config
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user