From 9ef137d3bc392bcc516b185e8940c62802a7ab15 Mon Sep 17 00:00:00 2001 From: Hachino Date: Sat, 13 Dec 2025 20:02:31 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20options=20de=20bor?= =?UTF-8?q?gmatic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/borgmatic/config.yaml.j2 | 85 ++++++++++++++++++- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/roles/borgbackup-client/templates/borgmatic/config.yaml.j2 b/roles/borgbackup-client/templates/borgmatic/config.yaml.j2 index 6cd54ff8..f49fd7a6 100644 --- a/roles/borgbackup-client/templates/borgmatic/config.yaml.j2 +++ b/roles/borgbackup-client/templates/borgmatic/config.yaml.j2 @@ -1,13 +1,90 @@ {{ ansible_header | comment }} -location: - source_directories: +# Cible à sauvegarder +source_directories: {% for dir in borg.to_backup %} - - {{ dir }} + - {{ dir }} {% endfor %} - repositories: +# Lieu de rétention des backups +repositories: {% for remote in borg.remote %} + - path: {{ remote }} +{% endfor %} + +# Regex excluant certains fichiers de la sauvegarde +exclude_patterns: + - '*.pyc' + - '\#*\#' + - '*~' +{% for pattern in borg.to_exclude | default([]) %} + - {{ pattern }} +{% endfor %} + +exclude_caches: true + +exclude_if_present: + - .nobackup + +borgmatic_runtime_directory: /tmp/borgmatic +borgmatic_state_directory: /tmp/borgmatic/state + +relocated_repo_access_is_ok: true +encryption_passphrase: {{ borg.encryption_passphrase }} +ssh_command: ssh -i /etc/borgmatic/id_ed25519_borg {{ borg.ssh_options | default("") }} +borg_base_directory: /etc/borgmatic +borg_config_directory: /etc/borgmatic/config/ +borg_cache_directory: /etc/borgmatic/cache +borg_security_directory: /etc/borgmatic/config/security +borg_keys_directory: /etc/borgmatic/config/keys +compression: 'lz4' +umask: 0077 +lock_wait: 5 +archive_name_format: '{hostname}-{now}' + +{% set extra_init = borg.extra_init | default([]) %} +{% set extra_prune = borg.extra_prune | default([]) %} +{% set extra_create = borg.extra_create | default([]) %} +{% set extra_check = borg.extra_check | default([]) %} +{% if extra_init or extra_prune or extra_create or extra_check %} +extra_borg_options: +{% endif %} +{% if extra_init %} + # Extra command-line options to pass to "borg init". + init: {% for cmd in extra_init %}--{{ cmd }} {% endfor %} +{% endif %} +{% if extra_prune %} + # Extra command-line options to pass to "borg prune". + prune: {% for cmd in extra_prune %}--{{ cmd }} {% endfor %} +{% endif %} +{% if extra_create %} + # Extra command-line options to pass to "borg create". + create: {% for cmd in extra_create %}--{{ cmd }} {% endfor %} +{% endif %} +{% if extra_check %} + # Extra command-line options to pass to "borg check". + check: {% for cmd in extra_check %}--{{ cmd }} {% endfor %} +{% endif %} + +# Politique de rétention des backups +{% for retention in borg.retention %} +keep_{{ retention[0] }}: {{ retention[1] }} +{% endfor %} + +skip_actions: +{% for check in borg.consistency_check %} + - {{ check }} +{% endfor %} + +{% if borg.hooks | default([]) %} +hooks: +{% for hook in borg.hooks %} + {{ hook.type }}: +{% for param in hook.params %} + {{ param }} +{% endfor %} +{% endfor %} +{% endif %} - {{ remote }} {% endfor %}