diff --git a/roles/borgmatic/tasks/main.yml b/roles/borgmatic/tasks/main.yml index 2eb16cb..a28fc37 100644 --- a/roles/borgmatic/tasks/main.yml +++ b/roles/borgmatic/tasks/main.yml @@ -53,3 +53,10 @@ owner: root group: root mode: 0600 + +- name: Initialize borg repository + become: true + ansible.builtin.command: + cmd: borgmatic init --encryption repokey + register: borgmatic_init + changed_when: borgmatic_init.stderr != '' diff --git a/roles/borgmatic/templates/borgmatic.d/config.yml.j2 b/roles/borgmatic/templates/borgmatic.d/config.yml.j2 index 3441ad3..6ea98ce 100644 --- a/roles/borgmatic/templates/borgmatic.d/config.yml.j2 +++ b/roles/borgmatic/templates/borgmatic.d/config.yml.j2 @@ -26,6 +26,7 @@ location: storage: encryption_passphrase: "{{ borg_passphrase }}" + ssh_command: ssh -o StrictHostKeyChecking=accept-new retention: keep_daily: 7