[EVO] Utiliser la nouvelle syntaxe #3
@ -36,7 +36,7 @@ Liste des éléments exclus de la sauvegarde.
|
|||||||
|
|
||||||
### borgmatic_repositories
|
### borgmatic_repositories
|
||||||
|
|
||||||
Liste des dépôts Borg sur lesquels envoyer la sauvegarde.
|
Dictionnaire contenant le `label` et le `path` des dépôts vers lesquels envoyer la sauvegarde.
|
||||||
|
|
||||||
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
||||||
|
|
||||||
|
@ -12,14 +12,22 @@ borgmatic_checks:
|
|||||||
frequency: 4 weeks
|
frequency: 4 weeks
|
||||||
- name: extract
|
- name: extract
|
||||||
frequency: 2 weeks
|
frequency: 2 weeks
|
||||||
|
|
||||||
borgmatic_healthchecks: ""
|
borgmatic_healthchecks: ""
|
||||||
borgmatic_exclude_patterns: []
|
borgmatic_exclude_patterns: []
|
||||||
|
|
||||||
borgmatic_repositories: []
|
borgmatic_repositories: []
|
||||||
|
# Exemple:
|
||||||
|
# - label: default
|
||||||
|
# path: ssh://user@backupserver/./sourcehostname.borg
|
||||||
|
|
||||||
borgmatic_source_directories: []
|
borgmatic_source_directories: []
|
||||||
|
|
||||||
borgmatic_retention:
|
borgmatic_retention:
|
||||||
daily: 7
|
daily: 7
|
||||||
monthly: 0
|
monthly: 0
|
||||||
weekly: 4
|
weekly: 4
|
||||||
|
|
||||||
borgmatic_name: "{{ inventory_hostname }}_{now}"
|
borgmatic_name: "{{ inventory_hostname }}_{now}"
|
||||||
borgmatic_compression: none
|
borgmatic_compression: none
|
||||||
borgmatic_passphrase: ""
|
borgmatic_passphrase: ""
|
||||||
|
@ -3,8 +3,16 @@
|
|||||||
|
|
||||||
- name: Créer le dépôt
|
- name: Créer le dépôt
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: borgmatic init --encryption repokey-blake2
|
cmd: borg init -e repokey-blake2 {{ item.path }}
|
||||||
become: true
|
become: true
|
||||||
|
loop: "{{ borgmatic_repositories }}"
|
||||||
|
register: borg_init
|
||||||
|
failed_when:
|
||||||
|
- "'A repository already exists' not in borg_init.stderr"
|
||||||
|
- borg_init.rc != 0
|
||||||
|
changed_when:
|
||||||
|
- "'A repository already exists' not in borg_init.stderr"
|
||||||
|
- borg_init.rc == 0
|
||||||
|
|
||||||
- name: Activer la planification
|
- name: Activer la planification
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK for role_borgmatic"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK for role_borgmatic"
|
||||||
block: |
|
block: |
|
||||||
{% for repository in borgmatic_repositories %}
|
{% for repository in borgmatic_repositories %}
|
||||||
Host {{ repository | ansible.builtin.urlsplit('hostname') }}
|
Host {{ repository.path | ansible.builtin.urlsplit('hostname') }}
|
||||||
IdentityFile /etc/borgmatic/id_ed25519
|
IdentityFile /etc/borgmatic/id_ed25519
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,24 +1,41 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
repositories:
|
||||||
|
{% for repository in borgmatic_repositories %}
|
||||||
|
- label: {{ repository.label }}
|
||||||
|
path: {{ repository.path }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
exclude_patterns:
|
||||||
|
{% for pattern in borgmatic_exclude_patterns %}
|
||||||
|
- {{ pattern }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
source_directories:
|
||||||
|
{% for directory in borgmatic_source_directories %}
|
||||||
|
- {{ directory }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
archive_name_format: {{ borgmatic_name }}
|
||||||
|
compression: {{ borgmatic_compression }}
|
||||||
|
encryption_passphrase: {{ borgmatic_passphrase }}
|
||||||
|
|
||||||
consistency:
|
consistency:
|
||||||
checks: {{ borgmatic_checks }}
|
checks:
|
||||||
|
{% for check in borgmatic_checks %}
|
||||||
|
- name: {{ check.name }}
|
||||||
|
frequency: {{ check.frequency }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
hooks:
|
hooks:
|
||||||
healthchecks:
|
healthchecks:
|
||||||
ping_url: {{ borgmatic_healthchecks }}
|
ping_url: {{ borgmatic_healthchecks }}
|
||||||
send_logs: false
|
send_logs: false
|
||||||
|
states:
|
||||||
location:
|
- finish
|
||||||
exclude_patterns: {{ borgmatic_exclude_patterns }}
|
- fail
|
||||||
repositories: {{ borgmatic_repositories }}
|
|
||||||
source_directories: {{ borgmatic_source_directories }}
|
|
||||||
|
|
||||||
retention:
|
retention:
|
||||||
keep_daily: {{ borgmatic_retention.daily }}
|
keep_daily: {{ borgmatic_retention.daily }}
|
||||||
keep_monthly: {{ borgmatic_retention.monthly }}
|
keep_monthly: {{ borgmatic_retention.monthly }}
|
||||||
keep_weekly: {{ borgmatic_retention.weekly }}
|
keep_weekly: {{ borgmatic_retention.weekly }}
|
||||||
|
|
||||||
storage:
|
|
||||||
archive_name_format: {{ borgmatic_name }}
|
|
||||||
compression: {{ borgmatic_compression }}
|
|
||||||
encryption_passphrase: {{ borgmatic_passphrase }}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user