Fixed Duplicity Roles
This commit is contained in:
parent
5ae3a0631c
commit
954420e9de
14 changed files with 1707 additions and 155 deletions
24
roles/duplicity_server/templates/backup-script.j2
Normal file
24
roles/duplicity_server/templates/backup-script.j2
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Cleanup old backups
|
||||
duplicity remove-all-inc-of-but-n-full 2 --force file://{{ duplicity_server_storage_root }}/{{item}}
|
||||
duplicity remove-all-but-n-full 3 --force file://{{ duplicity_server_storage_root }}/{{item}}
|
||||
|
||||
# Prepare mount directory
|
||||
rm -rf {{ duplicity_server_mount_root }}/{{ item }}
|
||||
mkdir -p {{ duplicity_server_mount_root }}/{{ item }}
|
||||
cd {{ duplicity_server_mount_root }}/{{ item }}
|
||||
|
||||
# mount the client directories through sshfs
|
||||
{% for path in hostvars[item].duplicity_client_backup_paths %}
|
||||
mkdir -p .{{ path }}
|
||||
sshfs {{ hostvars[item].duplicity_client_user | default(duplicity_client_user) }}@{{ item }}:{{path}} .{{ path }}
|
||||
{% endfor %}
|
||||
|
||||
# Perform the backup
|
||||
duplicity --full-if-older-than 1W --encrypt-key C05AD49B790BAC8E3B573B697B25171F921B9E57 . file://{{ duplicity_server_storage_root }}/{{item}}
|
||||
|
||||
# Unmount the directories
|
||||
{% for path in hostvars[item].duplicity_client_backup_paths %}
|
||||
fusermount -u .{{ path }}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue