Fetch exported keys

This commit is contained in:
phil 2023-04-08 23:20:21 +02:00
parent 3dd71eac1d
commit 4e6628e86c
2 changed files with 10 additions and 10 deletions

View file

@ -4,7 +4,7 @@ borg_exclude_patterns: []
borg_one_file_system: true
borg_exclude_from: []
borg_encryption_passcommand: false
borg_key_export_path: "~/{{ borg_repository }}.key"
borg_key_export_path: "/root/borg_keys"
borg_lock_wait_time: 5
borg_ssh_key_file_path: "/root/.ssh/{{ borg_ssh_key_name }}"
borg_ssh_key_name: borgbackup

View file

@ -20,18 +20,18 @@
responses:
^.*want to continue connecting.*$: "yes"
- name: "Borg | Create backup"
ansible.builtin.command:
cmd: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
- name: "Borg | Create key export directory"
ansible.builtin.file:
path: "{{ borg_key_export_path }}"
state: directory
mode: "0750"
- name: "Borg | Export repo key"
ansible.builtin.command:
cmd: "borg key export {{ item }}"
cmd: "borg key export {{ item }} > {{ borg_key_export_path }}/{{ item }}.key"
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
ansible.builtin.fetch:
src: "{{ repo_key_export.stdout }}"
dest: "~/"