[AUTO-RESTORE] Add all

This commit is contained in:
Florian RICHER 2023-05-21 19:56:51 +02:00
parent 7dd38fd226
commit a291e78db6
12 changed files with 267 additions and 12 deletions

View file

@ -1,4 +1,8 @@
---
- ansible.builtin.import_tasks: base.yml
name: base
name: base
- ansible.builtin.import_tasks: restore.yml
name: restore
when: restore.n8n.n8n_archive and restore.n8n.db_archive

View file

@ -0,0 +1,43 @@
---
- name: Copy archives
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- { src: '{{ restore.n8n.n8n_archive }}', dest: 'n8n_n8n.tar.gz' }
- { src: '{{ restore.n8n.db_archive }}', dest: 'n8n_db.tar.gz' }
- name: Stop nextcloud container
community.docker.docker_compose:
project_src: home_assistant
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: './n8n_n8n.tar.gz', volume: 'n8n_n8n' }
- { path: './n8n_db.tar.gz', volume: 'n8n_db' }
become: true
- name: Start nextcloud container
community.docker.docker_compose:
project_src: home_assistant
state: present
become: true
- name: Remove archive
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop:
- { path: 'n8n_n8n.tar.gz' }
- { path: 'n8n_db.tar.gz' }