30 lines
876 B
YAML
30 lines
876 B
YAML
---
|
|
|
|
- name: Fetch remote backups
|
|
hosts: all
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
- name: Fetch volume backups
|
|
fetch:
|
|
src: "{{ backup_location }}{{ item[0].name }}/{{ item[1] }}-volume-{{ date }}.tar.gz"
|
|
dest: "{{ local_backup }}{{ item[0].name }}/"
|
|
flat: yes
|
|
loop: "{{ containers | subelements('volumes', skip_missing=True) }}"
|
|
loop_control:
|
|
label: "{{ item[1] }}"
|
|
|
|
- name: Fetch database backups
|
|
fetch:
|
|
src: "{{ backup_location }}{{ item[0].name }}/{{ item[1].container }}-{{ date }}.sql.gz"
|
|
dest: "{{ local_backup }}{{ item[0].name }}/"
|
|
flat: yes
|
|
loop: "{{ containers | subelements('database', skip_missing=True) }}"
|
|
loop_control:
|
|
label: "{{ item[1].name }}"
|
|
|
|
- name: Clean backup directory
|
|
file:
|
|
path: "{{ backup_location }}"
|
|
state: absent
|
|
|