From 88dc6da60e800cb26cc6431a616de5d612b3e60e Mon Sep 17 00:00:00 2001 From: Leonidas Avdelas Date: Fri, 14 Nov 2025 17:38:23 +0200 Subject: [PATCH 1/2] Add retries and retry-wait Signed-off-by: Leonidas Avdelas --- templates/config.yaml.j2 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 index 54af4c9..4193c7e 100644 --- a/templates/config.yaml.j2 +++ b/templates/config.yaml.j2 @@ -89,6 +89,19 @@ storage: remote_rate_limit: {{ borg_remote_rate_limit }} {% endif %} + # Number of times to retry a failing backup before giving up. + # Defaults to 0 (i.e., does not attempt retry). +{% if borgmatic_retries is defined %} + retries: {{ borgmatic_retries }} +{% endif %} + + # Wait time between retries (in seconds) to allow transient + # issues to pass. Increases after each retry as a form of + # backoff. Defaults to 0 (no wait). +{% if borgmatic_retry_wait is defined %} + retry_wait: {{ borgmatic_retry_wait }} +{% endif %} + # Command to use instead of just "ssh". This can be used to specify ssh options. # ssh_command: ssh -i ~/.ssh/id_ed25519 {% if borg_ssh_command %} From ddd52f3f67f42be5dc37f74d8517265520bf094d Mon Sep 17 00:00:00 2001 From: Leonidas Avdelas Date: Mon, 17 Nov 2025 16:33:10 +0200 Subject: [PATCH 2/2] Add retries in meta spec and README Signed-off-by: Leonidas Avdelas --- README.md | 2 ++ meta/argument_specs.yml | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index ae15e9b..223870c 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansibl - `borg_pip_packages`: Dependancy Packages (pip) to install `borg(backup)` and `borgmatic`. - `borg_remote_path`: Path to the borg executable on the remote. It will default to `borg`. - `borg_remote_rate_limit`: Remote network upload rate limit in kiBytes/second. +- `borgmatic_retries`: Number of times to retry a failing backup before giving up. Defaults to 0 (i.e., does not attempt retry). +- `borgmatic_retry_wait`: Wait time between retries (in seconds) to allow transient issues to pass. Increases after each retry as a form of backoff. Defaults to 0 (no wait). - `borg_retention_policy`: Retention policy for how many backups to keep in each category (daily, weekly, monthly, etc). - `borg_source_directories`: List of local folders to back up. Default is `/etc/hostname` to prevent an empty backup. - `borg_ssh_key_name`: Name of the SSH public and pivate key. Default `id_ed25519` diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml index e074e45..9eb51fe 100644 --- a/meta/argument_specs.yml +++ b/meta/argument_specs.yml @@ -102,6 +102,18 @@ argument_specs: type: int required: false description: Remote network upload rate limit in kiBytes/second. + borgmatic_retries: + type: int + required: false + description: | + Number of times to retry a failing backup before giving up. + Defaults to 0 (i.e., does not attempt retry). + borgmatic_retry_wait: + type: int + required: false + description: | + Wait time between retries (in seconds) to allow transient issues to pass. + Increases after each retry as a form of backoff. Defaults to 0 (no wait). borg_ssh_key_file_path: type: str required: false