mirror of
https://github.com/roles-ansible/ansible_role_restic_archiver.git
synced 2024-08-16 10:09:49 +02:00
Improve mounting
This commit is contained in:
parent
c3dcb95c10
commit
65f6943a42
2 changed files with 18 additions and 12 deletions
|
@ -49,22 +49,15 @@ set -euxo pipefail
|
|||
{%- endmacro %}
|
||||
|
||||
{% if restic_archiver__mount_required %}
|
||||
{% raw %}
|
||||
if mountpoint -q {{ restic_archiver__mount_disk }}
|
||||
then
|
||||
echo "{{ restic_archiver__mount_disk }} is mounted"
|
||||
else
|
||||
mount -a
|
||||
fi
|
||||
{% endraw %}
|
||||
{% else %}
|
||||
{% macro validate_mounts() %}
|
||||
# be excellent to each other!
|
||||
{% endmacro %}
|
||||
{% endif %}
|
||||
|
||||
# Settings for Server {{ repo['name'] | string }}
|
||||
{{ validate_mounts }}
|
||||
export RESTIC_REPOSITORY="{{ repo['location'] }}"
|
||||
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}'
|
||||
BACKUP_NAME="{{ repo.name }}"
|
||||
|
@ -75,7 +68,6 @@ restic check
|
|||
|
||||
{% if repo.archive|default(false) %}
|
||||
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
|
||||
{{ validate_mounts }}
|
||||
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
|
||||
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
|
||||
export RESTIC_REPOSITORY2="{{ repo['location'] }}"
|
||||
|
@ -87,8 +79,15 @@ if ([ -z "$(restic cat config)" ]) 2>/dev/null; then
|
|||
restic init --copy-chunker-params
|
||||
fi
|
||||
|
||||
{% if restic_archiver__mount_required %}
|
||||
if mountpoint -q {{ restic_archiver__mount_disk }}
|
||||
then
|
||||
echo "{{ restic_archiver__mount_disk }} is mounted"
|
||||
else
|
||||
mount -a
|
||||
fi
|
||||
{% endif %}
|
||||
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
|
||||
{{ validate_mounts }}
|
||||
export RESTIC_REPOSITORY2="{{ repo['archive_location'] }}"
|
||||
export RESTIC_PASSWORD2='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
|
||||
export RESTIC_REPOSITORY="{{ repo['location'] }}"
|
||||
|
@ -99,8 +98,15 @@ restic copy
|
|||
|
||||
{% if repo.archive_cleanup %}
|
||||
|
||||
{% if restic_archiver__mount_required %}
|
||||
if mountpoint -q {{ restic_archiver__mount_disk }}
|
||||
then
|
||||
echo "{{ restic_archiver__mount_disk }} is mounted"
|
||||
else
|
||||
mount -a
|
||||
fi
|
||||
{% endif %}
|
||||
# ARCHIVE CLEANUP Settings for Server "{{ repo['name'] | string }}"
|
||||
{{ validate_mounts }}
|
||||
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
|
||||
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
|
||||
BACKUP_NAME="{{ repo.name }}_archive"
|
||||
|
@ -115,5 +121,5 @@ restic check
|
|||
|
||||
sync
|
||||
{% if restic_archiver__umount_after_usage %}
|
||||
umount restic_archiver__mount_disk
|
||||
umount {{ restic_archiver__mount_disk }}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
playbook_version_number: 26 # should be over ninethousand
|
||||
playbook_version_number: 27 # should be over ninethousand
|
||||
playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'
|
||||
|
|
Loading…
Reference in a new issue