You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
995 B
YAML
32 lines
995 B
YAML
### Example:
|
|
# ansible-playbook -v ansible/volume-restore.yml -e "container_name=mariadb"
|
|
---
|
|
- hosts: servers
|
|
tasks:
|
|
- name: Find volumes
|
|
ansible.builtin.shell: docker run --rm
|
|
-v /var/run/docker.sock:/var/run/docker.sock
|
|
-v /mnt/hdds/backups/:/mnt/hdds/backups/
|
|
ghcr.io/chatton/docker-volume-backup:master
|
|
list-backups
|
|
--host-path /mnt/hdds/backups/
|
|
--volume-name-filter {{container_name}}
|
|
--newest-only
|
|
register: out
|
|
- name: Stop the container
|
|
docker_container:
|
|
name: "{{container_name}}"
|
|
state: stopped
|
|
- name: Restore Volume
|
|
ansible.builtin.command: docker run --rm
|
|
-v /var/run/docker.sock:/var/run/docker.sock
|
|
ghcr.io/chatton/docker-volume-backup:master
|
|
restore-volume
|
|
--volume {{item.volumeName}}
|
|
--archive {{item.absoluteFilePath}}
|
|
with_items: "{{ out.stdout }}"
|
|
- name: Start the container
|
|
docker_container:
|
|
name: "{{container_name}}"
|
|
state: started
|