WIP: Export repo key

This commit is contained in:
phil 2023-04-08 23:08:58 +02:00
parent 00f0b60613
commit 3dd71eac1d
2 changed files with 15 additions and 9 deletions

View file

@ -1,11 +1,11 @@
---
- name: "Borgamtic | Copy configuration"
- name: "Borg | Copy borgmatic configuration"
ansible.builtin.template:
src: config.yaml.j2
dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
mode: "0600"
- name: "Borgmatic | Add cron job"
- name: "Borg | Add borgmatic cron job"
ansible.builtin.cron:
name: "{{ borgmatic_timer_cron_name }}"
hour: "{{ borgmatic_timer_hour }}"
@ -14,18 +14,24 @@
cron_file: "{{ borgmatic_timer_cron_name }}"
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
- name: "Borgmatic | Init borg repository"
- name: "Borg | Init borg repository"
ansible.builtin.expect:
command: "borgmatic init -e {{ borg_repo_key }}"
responses:
^.*want to continue connecting.*$: "yes"
- name: "Borgmatic | Create backup"
- name: "Borg | Create backup"
ansible.builtin.command:
cmd: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
- name: "Borgmatic | Export repo key"
- name: "Borg | Export repo key"
ansible.builtin.command:
cmd: "borg key export {{ item }} > {{ borg_key_export_path }}"
cmd: "borg key export {{ item }}"
loop: "{{ borg_repository }}"
register: repo_key_export
- name: "Borg | Save repo key to localhost"
ansible.builtin.copy:
content: "{{ repo_key_export.stdout }}"
dest: "{{ borg_key_export_path }}"
delegate_to: localhost

View file

@ -12,6 +12,6 @@
when: borgbase is defined and borgbase
tags: borgbase
- name: Setup borgmatic
ansible.builtin.import_tasks: borgmatic.yml
tags: borgmatic
- name: Setup borg
ansible.builtin.import_tasks: borg.yml
tags: borg