2019-02-28 11:40:24 +01:00
|
|
|
# Full config: https://gist.github.com/coaxial/46e36d89d7b81887f7275d587fe04c44
|
2019-10-24 07:05:19 +02:00
|
|
|
{% set archive_prefix = item | regex_replace("\\/$", "") | basename %}
|
2018-10-06 14:04:20 +02:00
|
|
|
location:
|
|
|
|
source_directories:
|
2019-10-24 07:05:19 +02:00
|
|
|
- {{ item }}
|
|
|
|
|
2018-10-29 04:50:18 +01:00
|
|
|
# Stay in same file system (do not cross mount points).
|
|
|
|
one_file_system: {{ borg_one_file_system }}
|
2018-10-06 14:04:20 +02:00
|
|
|
repositories:
|
|
|
|
- {{ borg_repository }}
|
|
|
|
|
|
|
|
# Any paths matching these patterns are excluded from backups. Globs and tildes
|
|
|
|
# are expanded. See the output of "borg help patterns" for more details.
|
|
|
|
exclude_patterns:
|
|
|
|
{% for dir in borg_exclude_patterns %}
|
|
|
|
- {{ dir }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2018-10-29 04:50:18 +01:00
|
|
|
# Read exclude patterns from one or more separate named files, one pattern per
|
|
|
|
# line. See the output of "borg help patterns" for more details.
|
|
|
|
exclude_from:
|
|
|
|
{% for dir in borg_exclude_from %}
|
|
|
|
- {{ dir }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2018-10-06 14:04:20 +02:00
|
|
|
# Exclude directories that contain a CACHEDIR.TAG file. See
|
|
|
|
# http://www.brynosaurus.com/cachedir/spec.html for details.
|
|
|
|
exclude_caches: true
|
|
|
|
|
|
|
|
# Exclude directories that contain a file with the given filename.
|
|
|
|
exclude_if_present: .nobackup
|
|
|
|
|
|
|
|
# Repository storage options. See
|
|
|
|
# https://borgbackup.readthedocs.io/en/stable/usage.html#borg-create and
|
|
|
|
# https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables for
|
|
|
|
# details.
|
|
|
|
storage:
|
|
|
|
encryption_passphrase: {{ borg_encryption_passphrase }}
|
2018-10-29 04:50:18 +01:00
|
|
|
|
|
|
|
# The standard output of this command is used to unlock the encryption key. Only
|
|
|
|
# use on repositories that were initialized with passcommand/repokey encryption.
|
|
|
|
# Note that if both encryption_passcommand and encryption_passphrase are set,
|
|
|
|
# then encryption_passphrase takes precedence.
|
|
|
|
# encryption_passcommand: secret-tool lookup borg-repository repo-name
|
|
|
|
{% if borg_encryption_passcommand %}
|
|
|
|
encryption_passcommand: {{ borg_encryption_passcommand }}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-10-06 14:04:20 +02:00
|
|
|
# Type of compression to use when creating archives. See
|
|
|
|
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-create for details.
|
|
|
|
# Defaults to no compression.
|
|
|
|
compression: auto,zstd
|
|
|
|
|
|
|
|
# Remote network upload rate limit in kiBytes/second.
|
|
|
|
#remote_rate_limit: 5000
|
|
|
|
|
|
|
|
# Command to use instead of just "ssh". This can be used to specify ssh options.
|
|
|
|
# ssh_command: ssh -i ~/.ssh/id_ed25519
|
2018-10-29 04:50:18 +01:00
|
|
|
{% if borg_ssh_command %}
|
2018-11-19 22:35:40 +01:00
|
|
|
ssh_command: {{ borg_ssh_command }}
|
2018-10-29 04:50:18 +01:00
|
|
|
{% endif %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# Umask to be used for borg create.
|
|
|
|
umask: 0077
|
|
|
|
|
|
|
|
# Maximum seconds to wait for acquiring a repository/cache lock.
|
|
|
|
lock_wait: 5
|
|
|
|
|
|
|
|
# Name of the archive. Borg placeholders can be used. See the output of
|
|
|
|
# "borg help placeholders" for details. Default is
|
|
|
|
# "{hostname}-{now:%Y-%m-%dT%H:%M:%S.%f}". If you specify this option, you must
|
|
|
|
# also specify a prefix in the retention section to avoid accidental pruning of
|
|
|
|
# archives with a different archive name format. And you should also specify a
|
|
|
|
# prefix in the consistency section as well.
|
2019-10-24 07:05:19 +02:00
|
|
|
archive_name_format: '{{ archive_prefix }}-{now}'
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# Retention policy for how many backups to keep in each category. See
|
|
|
|
# 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.
|
|
|
|
retention:
|
2019-07-19 23:52:28 +02:00
|
|
|
{% if borg_retention_policy.keep_secondly is defined %}
|
|
|
|
# Number of secondly archives to keep.
|
|
|
|
keep_secondly: {{ borg_retention_policy.keep_secondly }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if borg_retention_policy.keep_minutely is defined %}
|
|
|
|
# Number of minutely archives to keep.
|
|
|
|
keep_minutely: {{ borg_retention_policy.keep_minutely }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if borg_retention_policy.keep_hourly is defined %}
|
2018-10-06 14:04:20 +02:00
|
|
|
# Number of hourly archives to keep.
|
2019-07-19 23:52:28 +02:00
|
|
|
keep_hourly: {{ borg_retention_policy.keep_hourly }}
|
|
|
|
{% endif %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
2019-07-19 23:52:28 +02:00
|
|
|
{% if borg_retention_policy.keep_daily is defined %}
|
2018-10-06 14:04:20 +02:00
|
|
|
# Number of daily archives to keep.
|
2019-07-19 23:52:28 +02:00
|
|
|
keep_daily: {{ borg_retention_policy.keep_daily }}
|
|
|
|
{% endif %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
2019-07-19 23:52:28 +02:00
|
|
|
{% if borg_retention_policy.keep_weekly is defined %}
|
2018-10-06 14:04:20 +02:00
|
|
|
# Number of weekly archives to keep.
|
2019-07-19 23:52:28 +02:00
|
|
|
keep_weekly: {{ borg_retention_policy.keep_weekly }}
|
|
|
|
{% endif %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
2019-07-19 23:52:28 +02:00
|
|
|
{% if borg_retention_policy.keep_monthly is defined %}
|
2018-10-06 14:04:20 +02:00
|
|
|
# Number of monthly archives to keep.
|
2019-07-19 23:52:28 +02:00
|
|
|
keep_monthly: {{ borg_retention_policy.keep_monthly }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if borg_retention_policy.keep_yearly is defined %}
|
|
|
|
# Number of yearly archives to keep.
|
|
|
|
keep_yearly: {{ borg_retention_policy.keep_yearly }}
|
|
|
|
{% endif %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# When pruning, only consider archive names starting with this prefix.
|
|
|
|
# Borg placeholders can be used. See the output of "borg help placeholders" for
|
|
|
|
# details. Default is "{hostname}-".
|
2019-10-24 07:05:19 +02:00
|
|
|
prefix: '{{ archive_prefix }}-'
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# Consistency checks to run after backups. See
|
|
|
|
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-check and
|
|
|
|
# https://borgbackup.readthedocs.org/en/stable/usage.html#borg-extract for details.
|
|
|
|
consistency:
|
|
|
|
# List of one or more consistency checks to run: "repository", "archives", and/or
|
|
|
|
# "extract". Defaults to "repository" and "archives". Set to "disabled" to disable
|
|
|
|
# all consistency checks. "repository" checks the consistency of the repository,
|
|
|
|
# "archive" checks all of the archives, and "extract" does an extraction dry-run
|
|
|
|
# of just the most recent archive.
|
|
|
|
checks:
|
2019-05-01 04:39:07 +02:00
|
|
|
- repository
|
|
|
|
- archives
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# Restrict the number of checked archives to the last n. Applies only to the "archives" check.
|
|
|
|
check_last: 3
|
|
|
|
|
|
|
|
# When performing the "archives" check, only consider archive names starting with
|
|
|
|
# this prefix. Borg placeholders can be used. See the output of
|
|
|
|
# "borg help placeholders" for details. Default is "{hostname}-".
|
2019-10-24 07:05:19 +02:00
|
|
|
prefix: '{{ archive_prefix }}-'
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# Shell commands or scripts to execute before and after a backup or if an error has occurred.
|
|
|
|
# IMPORTANT: All provided commands and scripts are executed with user permissions of borgmatic.
|
|
|
|
# Do not forget to set secure permissions on this file as well as on any script listed (chmod 0700) to
|
|
|
|
# prevent potential shell injection or privilege escalation.
|
|
|
|
hooks:
|
|
|
|
# List of one or more shell commands or scripts to execute before creating a backup.
|
|
|
|
before_backup:
|
|
|
|
- echo "`date` - Starting backup."
|
2019-10-24 07:07:37 +02:00
|
|
|
{% for cmd in borgmatic_before_backup_command %}
|
|
|
|
- {{ cmd }}
|
|
|
|
{% endfor %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# List of one or more shell commands or scripts to execute after creating a backup.
|
|
|
|
after_backup:
|
|
|
|
- echo "`date` - Finished backup."
|
2019-10-24 07:07:37 +02:00
|
|
|
{% for cmd in borgmatic_after_backup_command %}
|
|
|
|
- {{ cmd }}
|
|
|
|
{% endfor %}
|
2018-10-06 14:04:20 +02:00
|
|
|
|
|
|
|
# List of one or more shell commands or scripts to execute in case an exception has occurred.
|
|
|
|
on_error:
|
2019-10-24 07:07:37 +02:00
|
|
|
{% for cmd in borgmatic_failure_command %}
|
|
|
|
- {{ cmd }}
|
|
|
|
{% endfor %}
|