From 32f46bdac5a5b36fa93d0cf836461a884661e003 Mon Sep 17 00:00:00 2001 From: nd <git@notandy.de> Date: Wed, 18 Aug 2021 13:03:09 +0100 Subject: [PATCH] add bandwidth limit by default --- README.md | 2 ++ defaults/main.yml | 1 + templates/backup-export.j2 | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c87d642..2f9e1b7 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ export: # type: rsync # port: 22 # 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 remote_sftp_user: diff --git a/defaults/main.yml b/defaults/main.yml index 116687f..e54bd06 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,6 +28,7 @@ backups: years: 3 export: destinations: [] + bwlimit: 2500 remote_sftp_user: name: backup host: ~ diff --git a/templates/backup-export.j2 b/templates/backup-export.j2 index 3cffe8e..f8e40cf 100755 --- a/templates/backup-export.j2 +++ b/templates/backup-export.j2 @@ -10,7 +10,7 @@ echo "Starting to export backups..." {% if backups.backends.restic.repo_type == "local" %} {% for i in backups.export.destinations if i.type == "rsync" %} 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 %} {% else %} echo "Repo is not local. Skipped." -- GitLab