1
0
Fork 0
myserver-configuration/roles/matrix/tasks/restore.yml

52 lines
No EOL
1.8 KiB
YAML

---
- name: Copy archives
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- { src: '{{ restore.matrix.db_archive }}', dest: 'matrix_db.tar.gz' }
- { src: '{{ restore.matrix.matrix_archive }}', dest: 'matrix_matrix.tar.gz' }
- { src: '{{ restore.matrix.mautrix_facebook_archive }}', dest: 'matrix_mautrix_facebook.tar.gz' }
- { src: '{{ restore.matrix.mautrix_instagram_archive }}', dest: 'matrix_mautrix_instagram.tar.gz' }
- { src: '{{ restore.matrix.mautrix_discord_archive }}', dest: 'matrix_mautrix_discord.tar.gz' }
- name: Stop nextcloud container
community.docker.docker_compose:
project_src: matrix
state: absent
become: true
- name: Restore backup
community.docker.docker_container:
name: volume_restore
image: volume_restore:latest
auto_remove: yes
tty: true
volumes:
- "{{ item.path }}:/backup/archive.tar.gz"
- "{{ item.volume }}:/backup/dest"
loop:
- { path: './matrix_db.tar.gz', volume: 'matrix_db' }
- { path: './matrix_matrix.tar.gz', volume: 'matrix_matrix' }
- { path: './matrix_mautrix_facebook.tar.gz', volume: 'matrix_mautrix_facebook' }
- { path: './matrix_mautrix_instagram.tar.gz', volume: 'matrix_mautrix_instagram' }
- { path: './matrix_mautrix_discord.tar.gz', volume: 'matrix_mautrix_discord' }
become: true
- name: Start nextcloud container
community.docker.docker_compose:
project_src: matrix
state: present
become: true
- name: Remove archive
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop:
- { path: 'matrix_db.tar.gz' }
- { path: 'matrix_matrix.tar.gz' }
- { path: 'matrix_mautrix_facebook.tar.gz' }
- { path: 'matrix_mautrix_instagram.tar.gz' }
- { path: 'matrix_mautrix_discord.tar.gz' }