fix borgmatic removal of config-sections

This commit is contained in:
Raphael Pertl 2023-08-15 10:02:06 +02:00
parent cbe280e7ff
commit 796aebad03

View File

@ -3,7 +3,7 @@
# Managed by Ansible, please don't edit manually
# Full config: https://torsion.org/borgmatic/docs/reference/config.yaml
location:
{% if borg_source_directories is not defined or borg_source_directories | length == 0 %}
source_directories:
- /etc/hostname # prevent empty backupconfig
@ -16,14 +16,6 @@ location:
# Stay in same file system (do not cross mount points).
one_file_system: {{ borg_one_file_system }}
repositories:
{% if borg_repository is iterable and (borg_repository is not string and borg_repository is not mapping) %}
{% for repo in borg_repository %}
- {{ repo }}
{% endfor %}
{% elif borg_repository is defined and borg_repository is string %}
- {{ borg_repository }}
{% endif %}
# Store atime into archive.
atime: {{ borgmatic_store_atime }}
@ -31,6 +23,15 @@ location:
# Store ctime into archive.
ctime: {{ borgmatic_store_ctime }}
repositories:
{% if borg_repository is iterable and (borg_repository is not string and borg_repository is not mapping) %}
{% for repo in borg_repository %}
- path: {{ repo }}
{% endfor %}
{% elif borg_repository is defined and borg_repository is string %}
- path: {{ borg_repository }}
{% endif %}
{% if borg_exclude_patterns %}
# Any paths matching these patterns are excluded from backups. Globs and tildes
# are expanded. See the output of "borg help patterns" for more details.
@ -53,7 +54,8 @@ location:
exclude_caches: true
# Exclude directories that contain a file with the given filename.
exclude_if_present: .nobackup
exclude_if_present:
- .nobackup
# Alternate Borg remote executable. Defaults to "borg".
# remote_path: borg1
@ -65,7 +67,6 @@ location:
# 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 }}
# The standard output of this command is used to unlock the encryption key. Only
@ -113,7 +114,7 @@ storage:
# 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:
{% if borg_retention_policy.keep_secondly is defined %}
# Number of secondly archives to keep.
keep_secondly: {{ borg_retention_policy.keep_secondly }}
@ -152,7 +153,7 @@ retention:
# 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", "data", and/or "extract". Defaults to
# "repository" and "archives". Set to "disabled" to disable
@ -173,7 +174,7 @@ consistency:
# 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:
{% for hook in borgmatic_hooks %}
{{ hook }}:
{{ borgmatic_hooks[hook] | to_nice_yaml(indent=2) | trim | indent(8) }}