Add options for consistency checks and storage. By @kenayagi (#50)

* borg_remote_rate_limit config
* borg_remote_rate_limit optional argument
* Set default rate_limit to 0 (unlimited)
* additional options for checks and storage
This commit is contained in:
K 2020-12-24 01:23:33 +01:00 committed by GitHub
parent e29c4df98c
commit e9caa74560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 14 deletions

View File

@ -56,6 +56,11 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgba
### Optional Arguments ### Optional Arguments
- `borg_encryption_passphrase`: Password to use for repokey or keyfile. Empty if repo is unencrypted. - `borg_encryption_passphrase`: Password to use for repokey or keyfile. Empty if repo is unencrypted.
- `borgmatic_checks`: List of consistency checks. Defaults to `['repository']`
- `borgmatic_check_last`: Number of archives to check. Defaults to `3`
- `borgmatic_store_atime`: Store atime into archive. Defaults to `true`
- `borgmatic_store_ctime`: Store ctime into archive. Defaults to `true`
- `borgmatic_relocated_repo_access_is_ok`: Bypass Borg error about a repository that has been moved. Defaults to `false`
- `borgmatic_config_name`: Name to use for the borgmatic config file. Defaults to `config.yaml` - `borgmatic_config_name`: Name to use for the borgmatic config file. Defaults to `config.yaml`
- `borgmatic_large_repo`: Less frequent, monthly repo checking. Defaults to `true` - `borgmatic_large_repo`: Less frequent, monthly repo checking. Defaults to `true`
- `borgmatic_failure_command`: Run this command when an error occurs. E.g. `curl -s -F "token=xxx" -F "user=xxx" -F "message=Error during backup" https://api.pushover.net/1/messages.json` - `borgmatic_failure_command`: Run this command when an error occurs. E.g. `curl -s -F "token=xxx" -F "user=xxx" -F "message=Error during backup" https://api.pushover.net/1/messages.json`

View File

@ -5,8 +5,16 @@ borgmatic_config_name: config.yaml
borgmatic_large_repo: true borgmatic_large_repo: true
borgmatic_failure_command: borgmatic_failure_command:
- echo "`date` - Error while creating a backup." - echo "`date` - Error while creating a backup."
borgmatic_before_backup_command: [] borgmatic_before_backup_command:
borgmatic_after_backup_command: [] - echo "`date` - Starting backup."
borgmatic_after_backup_command:
- echo "`date` - Finished backup."
borgmatic_checks:
- repository
borgmatic_check_last: 3
borgmatic_store_atime: true
borgmatic_store_ctime: true
borgmatic_relocated_repo_access_is_ok: false
borgmatic_hooks: [] borgmatic_hooks: []
borg_one_file_system: true borg_one_file_system: true
borg_exclude_from: [] borg_exclude_from: []

View File

@ -1,5 +1,5 @@
#jinja2: lstrip_blocks: "True", trim_blocks: "True" #jinja2: lstrip_blocks: "True", trim_blocks: "True"
# Full config: https://gist.github.com/coaxial/46e36d89d7b81887f7275d587fe04c44 # Full config: https://torsion.org/borgmatic/docs/reference/config.yaml
location: location:
source_directories: source_directories:
{% for dir in borg_source_directories %} {% for dir in borg_source_directories %}
@ -17,6 +17,12 @@ location:
- {{ borg_repository }} - {{ borg_repository }}
{% endif %} {% endif %}
# Store atime into archive.
atime: {{ borgmatic_store_atime }}
# Store ctime into archive.
ctime: {{ borgmatic_store_ctime }}
# Any paths matching these patterns are excluded from backups. Globs and tildes # Any paths matching these patterns are excluded from backups. Globs and tildes
# are expanded. See the output of "borg help patterns" for more details. # are expanded. See the output of "borg help patterns" for more details.
exclude_patterns: exclude_patterns:
@ -90,6 +96,9 @@ storage:
# prefix in the consistency section as well. # prefix in the consistency section as well.
archive_name_format: '{hostname}-{now}' archive_name_format: '{hostname}-{now}'
# Bypass Borg error about a repository that has been moved.
relocated_repo_access_is_ok: {{ borgmatic_relocated_repo_access_is_ok }}
# Retention policy for how many backups to keep in each category. See # Retention policy for how many backups to keep in each category. See
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-prune for details. # https://borgbackup.readthedocs.org/en/stable/usage.html#borg-prune for details.
# At least one of the "keep" options is required for pruning to work. # At least one of the "keep" options is required for pruning to work.
@ -138,18 +147,21 @@ retention:
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-check and # https://borgbackup.readthedocs.org/en/stable/usage.html#borg-check and
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-extract for details. # https://borgbackup.readthedocs.org/en/stable/usage.html#borg-extract for details.
consistency: consistency:
# List of one or more consistency checks to run: "repository", "archives", and/or # List of one or more consistency checks to run: "repository",
# "extract". Defaults to "repository" and "archives". Set to "disabled" to disable # "archives", "data", and/or "extract". Defaults to
# all consistency checks. "repository" checks the consistency of the repository, # "repository" and "archives". Set to "disabled" to disable
# "archive" checks all of the archives, and "extract" does an extraction dry-run # all consistency checks. "repository" checks the consistency
# of just the most recent archive. # of the repository, "archives" checks all of the archives,
# "data" verifies the integrity of the data within the
# archives, and "extract" does an extraction dry-run of the
# most recent archive. Note that "data" implies "archives".
checks: checks:
- repository {% for checks in borgmatic_checks %}
# - archives - {{ checks }}
# - disabled {% endfor %}
# Restrict the number of checked archives to the last n. Applies only to the "archives" check. # Restrict the number of checked archives to the last n. Applies only to the "archives" check.
check_last: 3 check_last: {{ borgmatic_check_last }}
# When performing the "archives" check, only consider archive names starting with # When performing the "archives" check, only consider archive names starting with
# this prefix. Borg placeholders can be used. See the output of # this prefix. Borg placeholders can be used. See the output of
@ -163,14 +175,12 @@ consistency:
hooks: hooks:
# List of one or more shell commands or scripts to execute before creating a backup. # List of one or more shell commands or scripts to execute before creating a backup.
before_backup: before_backup:
- echo "`date` - Starting backup."
{% for cmd in borgmatic_before_backup_command %} {% for cmd in borgmatic_before_backup_command %}
- {{ cmd }} - {{ cmd }}
{% endfor %} {% endfor %}
# List of one or more shell commands or scripts to execute after creating a backup. # List of one or more shell commands or scripts to execute after creating a backup.
after_backup: after_backup:
- echo "`date` - Finished backup."
{% for cmd in borgmatic_after_backup_command %} {% for cmd in borgmatic_after_backup_command %}
- {{ cmd }} - {{ cmd }}
{% endfor %} {% endfor %}