[AUTO-RESTORE] Add all
This commit is contained in:
parent
7dd38fd226
commit
a291e78db6
12 changed files with 267 additions and 12 deletions
|
@ -19,4 +19,20 @@ protonmail:
|
|||
restore:
|
||||
cloud:
|
||||
nextcloud_archive: false
|
||||
db_archive: false
|
||||
db_archive: false
|
||||
home_assistant:
|
||||
home_assistant_config_archive: false
|
||||
matrix:
|
||||
db_archive: false
|
||||
matrix_archive: false
|
||||
mautrix_facebook_archive: false
|
||||
mautrix_instagram_archive: false
|
||||
mautrix_discord_archive: false
|
||||
n8n:
|
||||
n8n_archive: false
|
||||
db_archive: false
|
||||
protonmail:
|
||||
protonmail_archive: false
|
||||
traefik:
|
||||
prometheus_archive: false
|
||||
grafana_archive: false
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- { src: '{{ restore.cloud.nextcloud_archive }}', dest: 'nextcloud_archive.tar.gz' }
|
||||
- { src: '{{ restore.cloud.db_archive }}', dest: 'db_archive.tar.gz' }
|
||||
- { src: '{{ restore.cloud.nextcloud_archive }}', dest: 'cloud_nextcloud.tar.gz' }
|
||||
- { src: '{{ restore.cloud.db_archive }}', dest: 'cloud_db.tar.gz' }
|
||||
|
||||
- name: Stop nextcloud container
|
||||
community.docker.docker_compose:
|
||||
|
@ -19,12 +19,13 @@
|
|||
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: './nextcloud_archive.tar.gz', volume: 'cloud_nextcloud' }
|
||||
- { path: './db_archive.tar.gz', volume: 'cloud_db' }
|
||||
- { path: './cloud_nextcloud.tar.gz', volume: 'cloud_nextcloud' }
|
||||
- { path: './cloud_db.tar.gz', volume: 'cloud_db' }
|
||||
become: true
|
||||
|
||||
- name: Start nextcloud container
|
||||
|
@ -38,5 +39,5 @@
|
|||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
loop:
|
||||
- { path: 'nextcloud_archive.tar.gz' }
|
||||
- { path: 'db_archive.tar.gz' }
|
||||
- { path: 'cloud_nextcloud.tar.gz' }
|
||||
- { path: 'cloud_db.tar.gz' }
|
|
@ -1,4 +1,8 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
||||
name: base
|
||||
|
||||
- ansible.builtin.import_tasks: restore.yml
|
||||
name: restore
|
||||
when: restore.home_assistant.home_assistant_config_archive
|
40
roles/home_assistant/tasks/restore.yml
Normal file
40
roles/home_assistant/tasks/restore.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
|
||||
- name: Copy archives
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- { src: '{{ restore.home_assistant.home_assistant_config_archive }}', dest: 'home_assistant_home_assistant_config.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: './home_assistant_home_assistant_config.tar.gz', volume: 'home_assistant_home_assistant_config' }
|
||||
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: 'home_assistant_home_assistant_config.tar.gz' }
|
|
@ -1,4 +1,8 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
||||
name: base
|
||||
|
||||
- ansible.builtin.import_tasks: restore.yml
|
||||
name: restore
|
||||
when: restore.matrix.db_archive and restore.matrix.matrix_archive and restore.matrix.mautrix_facebook_archive and restore.matrix.mautrix_instagram_archive and restore.matrix.mautrix_discord_archive
|
52
roles/matrix/tasks/restore.yml
Normal file
52
roles/matrix/tasks/restore.yml
Normal file
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
|
||||
- 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' }
|
|
@ -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
|
||||
|
|
43
roles/n8n/tasks/restore.yml
Normal file
43
roles/n8n/tasks/restore.yml
Normal 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' }
|
|
@ -1,4 +1,8 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
||||
name: base
|
||||
|
||||
- ansible.builtin.import_tasks: restore.yml
|
||||
name: restore
|
||||
when: restore.protonmail.protonmail_archive
|
40
roles/protonmail/tasks/restore.yml
Normal file
40
roles/protonmail/tasks/restore.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
|
||||
- name: Copy archives
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- { src: '{{ restore.protonmail.protonmail_archive }}', dest: 'protonmail_protonmail.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: './protonmail_protonmail.tar.gz', volume: 'protonmail_protonmail' }
|
||||
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: 'protonmail_protonmail.tar.gz' }
|
|
@ -1,4 +1,8 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
||||
name: base
|
||||
|
||||
- ansible.builtin.import_tasks: restore.yml
|
||||
name: restore
|
||||
when: restore.traefik.prometheus_archive and restore.traefik.grafana_archive
|
||||
|
|
43
roles/traefik/tasks/restore.yml
Normal file
43
roles/traefik/tasks/restore.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
|
||||
- name: Copy archives
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- { src: '{{ restore.traefik.prometheus_archive }}', dest: 'traefik_prometheus.tar.gz' }
|
||||
- { src: '{{ restore.traefik.grafana_archive }}', dest: 'traefik_grafana.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: './traefik_prometheus.tar.gz', volume: 'traefik_prometheus' }
|
||||
- { path: './traefik_grafana.tar.gz', volume: 'traefik_grafana' }
|
||||
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: 'traefik_prometheus.tar.gz' }
|
||||
- { path: 'traefik_grafana.tar.gz' }
|
Loading…
Reference in a new issue