Restore volumes from their dedicated buckets.

This commit is contained in:
yohan 2024-04-28 11:51:05 +02:00
parent b17d36110d
commit 81f647b9d0
6 changed files with 6 additions and 57 deletions

View File

@ -49,7 +49,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -69,15 +69,6 @@
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
when: not scuttle_installed_flag.stat.exists
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- scuttle_code
- scuttle_php5-fpm_conf
when: not scuttle_installed_flag.stat.exists
- name: Login to {{ private_registry_domain }} and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: "{{ private_registry_user }}"

View File

@ -46,7 +46,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -67,16 +67,6 @@
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
when: not grafana_installed_flag.stat.exists
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- etc_grafana
- var_lib_grafana
- var_log_grafana
when: not grafana_installed_flag.stat.exists
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"

View File

@ -28,7 +28,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -47,14 +47,6 @@
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
when: not nextcloud_installed_flag.stat.exists
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- nextcloud
when: not nextcloud_installed_flag.stat.exists
- name: Create /usr/local/docker-mounted-files/docker-nextcloud-stack directory
ansible.builtin.file:
path: "/usr/local/docker-mounted-files/docker-nextcloud-stack"

View File

@ -54,7 +54,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -75,16 +75,6 @@
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
when: not registry_installed_flag.stat.exists
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- registry_data
- registry_auth
- registry_certs
when: not registry_installed_flag.stat.exists
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"

View File

@ -28,7 +28,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -47,14 +47,6 @@
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
when: not gogs_installed_flag.stat.exists
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- gogs_data
when: not gogs_installed_flag.stat.exists
- name: Create gogs container
containers.podman.podman_container:
name: gogs

View File

@ -63,7 +63,7 @@
- name: restore volume backup
ansible.builtin.command:
cmd: "duplicity restore --file-to-restore {{ item }}.tar.gz --do-not-restore-ownership --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} swift://backup_ovh1 {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz"
cmd: "duplicity restore --archive-dir {{ DUPLICITY_ARCHIVE_DIR }} --name {{ item }} swift://{{ item }} /mnt/volumes/{{ item }}/data"
environment:
SWIFT_USERNAME: "{{ OS_USERNAME }}"
SWIFT_PASSWORD: "{{ OS_PASSWORD }}"
@ -81,9 +81,3 @@
failed_when: duplicity_result is failed and (duplicity_result.rc is not defined or duplicity_result.rc != 11)
changed_when: duplicity_result.rc is defined and duplicity_result.rc == 0
- name: Unarchive volume backup
ansible.builtin.command:
cmd: "tar -xzvf {{ DUPLICITY_WORKDIR }}/{{ item }}.tar.gz -C /mnt/volumes/{{ item }}/data --strip 2"
become: true
with_items:
- mysql-server_dumps