[borgbackups] Initialize borg repository.

certbot_on_virtu
_pollion 2020-12-03 03:37:32 +01:00
parent 2850679ced
commit 79f30669b3
2 changed files with 12 additions and 1 deletions

View File

@ -41,6 +41,12 @@
owner: root
group: root
- name: Init borg repository
command:
cmd: /usr/bin/borgmatic init -e repokey
register: borg_init
changed_when: '"does not exist" in borg_init.stderr'
- name: Deploy borg cron
template:
src: "cron.d/borg.j2"

View File

@ -38,12 +38,17 @@ storage:
umask: 0077
lock_wait: 5
archive_name_format: '{hostname}-{now}'
{% set extra_init = borg.extra_prune | 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: --make-parent-dirs {% for cmd in borg.extra_init | default([]) %}--{{ cmd }} {% endfor %}
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 %}