Begin remove backup from docker + Debian support

This commit is contained in:
Florian RICHER 2023-06-08 23:51:39 +02:00
parent e026113bb7
commit 7fe8837098
31 changed files with 82 additions and 565 deletions

View file

@ -2,7 +2,3 @@
- ansible.builtin.import_tasks: base.yml
name: base
- ansible.builtin.import_tasks: restore.yml
name: restore
when: restore.home_assistant.home_assistant_config_archive

View file

@ -1,40 +0,0 @@
---
- 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' }

View file

@ -22,19 +22,5 @@ services:
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
# BACKUP
backup_home_assistant_config:
image: offen/docker-volume-backup:latest
restart: always
environment:
BACKUP_CRON_EXPRESSION: "{{ server.backup.cron_expression }}"
BACKUP_FILENAME: "{{ server.backup.filename_date_format }}-home-assistant-config.tar.gz"
BACKUP_LATEST_SYMLINK: home-assistant-config.latest.tar.gz
BACKUP_EXCLUDE_REGEXP: "\\.log$$"
BACKUP_RETENTION_DAYS: "{{ server.backup.retention_days }}"
volumes:
- home_assistant_config:/backup:ro
- {{ server.backup.folder }}/home_assistant:/archive
volumes:
home_assistant_config: