Merge branch 'master' of ssh://git-ssh.notandy.de:2222/ansible/roles/backup-client
This commit is contained in:
commit
9ddce74914
8 changed files with 12 additions and 4 deletions
|
|
@ -69,6 +69,8 @@ export:
|
||||||
# type: rsync
|
# type: rsync
|
||||||
# port: 22
|
# port: 22
|
||||||
# key: "/etc/backup-client/id_ed25519"
|
# key: "/etc/backup-client/id_ed25519"
|
||||||
|
# Bandwidth limit for upload, 20mbit/s by default
|
||||||
|
bwlimit: 2500
|
||||||
|
|
||||||
# Settings to create a remote sftp user. Use this for restic sftp repos
|
# Settings to create a remote sftp user. Use this for restic sftp repos
|
||||||
remote_sftp_user:
|
remote_sftp_user:
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ backups:
|
||||||
years: 3
|
years: 3
|
||||||
export:
|
export:
|
||||||
destinations: []
|
destinations: []
|
||||||
|
bwlimit: 2500
|
||||||
remote_sftp_user:
|
remote_sftp_user:
|
||||||
name: backup
|
name: backup
|
||||||
host: ~
|
host: ~
|
||||||
|
|
@ -41,6 +42,7 @@ backups:
|
||||||
'/tmp/*': true
|
'/tmp/*': true
|
||||||
'/var/tmp/*': true
|
'/var/tmp/*': true
|
||||||
'/var/cache/*': true
|
'/var/cache/*': true
|
||||||
|
'/var/lib/php/sessions/*': true
|
||||||
'/root/.ansible/*': true
|
'/root/.ansible/*': true
|
||||||
include_files:
|
include_files:
|
||||||
'/': true
|
'/': true
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
backup_backend: "{% if backups.mode in ['standalone-restic', 'hypervisor-restic'] %}restic{% else %}False{% endif %}"
|
backup_backend: "{% if backups.mode in ['standalone-restic', 'hypervisor-restic'] %}restic{% else %}False{% endif %}"
|
||||||
backup_executor: "{% if backups.mode in ['vm-via-hypervisor'] %}False{% else %}True{% endif %}"
|
backup_executor: "{% if backups.mode in ['vm-via-hypervisor'] %}False{% else %}True{% endif %}"
|
||||||
|
backup_restic_cache: "{% if backups.backends.restic.repo_type == 'local' %}False{% else %}True{% endif %}"
|
||||||
|
|
||||||
- name: create config folder
|
- name: create config folder
|
||||||
file:
|
file:
|
||||||
|
|
@ -106,7 +107,7 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0700
|
mode: 0711
|
||||||
|
|
||||||
- name: create a remote sftp user if enabled
|
- name: create a remote sftp user if enabled
|
||||||
when:
|
when:
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ set -euo pipefail
|
||||||
# restic backend
|
# restic backend
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
|
|
||||||
restic check --read-data --cleanup-cache
|
restic check --read-data \
|
||||||
|
--cleanup-cache{% if not backup_restic_cache %} --no-cache{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ echo "Starting to export backups..."
|
||||||
{% if backups.backends.restic.repo_type == "local" %}
|
{% if backups.backends.restic.repo_type == "local" %}
|
||||||
{% for i in backups.export.destinations if i.type == "rsync" %}
|
{% for i in backups.export.destinations if i.type == "rsync" %}
|
||||||
echo "exporting to {{ i.host }}"
|
echo "exporting to {{ i.host }}"
|
||||||
rsync -h -r -a --append-verify --delete --stats -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}"
|
rsync -h -r -a --append-verify --delete --stats{%if backups.export.bwlimit %} --bwlimit={{ backups.export.bwlimit }}{% endif %} -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
echo "Repo is not local. Skipped."
|
echo "Repo is not local. Skipped."
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ source /etc/backup-client/retention.env
|
||||||
# restic backend
|
# restic backend
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
restic forget \
|
restic forget \
|
||||||
--cleanup-cache \
|
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--prune \
|
--prune \
|
||||||
--group-by "host,paths,tags" \
|
--group-by "host,paths,tags" \
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ test -f "/etc/backup-client/enabled" || { echo "Standalone backup is disabled";
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
|
|
||||||
restic backup \
|
restic backup \
|
||||||
|
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--exclude-caches \
|
--exclude-caches \
|
||||||
--one-file-system \
|
--one-file-system \
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ set -euo pipefail
|
||||||
# restic backend
|
# restic backend
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
restic backup \
|
restic backup \
|
||||||
|
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--host "$DOMAIN" \
|
--host "$DOMAIN" \
|
||||||
--exclude-file "/etc/backup-client/vms/$DOMAIN/exclude_files" \
|
--exclude-file "/etc/backup-client/vms/$DOMAIN/exclude_files" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue