2024-04-14 17:39:49 +00:00
|
|
|
---
|
2024-04-14 18:01:40 +00:00
|
|
|
- name: Find hard links in /mnt/volumes/{{ item }}
|
2024-04-14 17:39:49 +00:00
|
|
|
ansible.builtin.command: "find '/mnt/volumes/{{ item }}' -type f -links +1"
|
|
|
|
register: find_hard_links
|
|
|
|
|
|
|
|
# Duplicity does not support hard links
|
|
|
|
- name: Assert that there is no hard links in /mnt/volumes/{{ item }}
|
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
2024-04-14 17:45:36 +00:00
|
|
|
- find_hard_links.stdout | length == 0
|
2024-04-14 17:39:49 +00:00
|
|
|
msg: "Duplicity does not support hard links."
|
|
|
|
|
2024-04-14 18:01:40 +00:00
|
|
|
- name: Backup /mnt/volumes/{{ item }} with duplicity
|
2024-04-14 17:39:49 +00:00
|
|
|
ansible.builtin.command: "duplicity --num-retries 3 --full-if-older-than 1M --progress --archive-dir {{ ARCHIVE_DIR }} --name {{ item }} --allow-source-mismatch '/mnt/volumes/{{ item }}' swift://{{ lookup('env','BACKUP_WORKFLOW') }}"
|
|
|
|
environment: "{{ DUPLICITY_ENVIRONMENT }}"
|
|
|
|
|
2024-04-14 18:01:40 +00:00
|
|
|
- name: Clean old duplicity backups for {{ item }}
|
2024-04-14 17:39:49 +00:00
|
|
|
ansible.builtin.command: "duplicity remove-older-than 2M --archive-dir {{ ARCHIVE_DIR }} --name {{ item }} --allow-source-mismatch --force swift://{{ lookup('env','BACKUP_WORKFLOW') }}"
|
|
|
|
environment: "{{ DUPLICITY_ENVIRONMENT }}"
|