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

40 lines
No EOL
1 KiB
YAML

---
- 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' }