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_one_file_system: true
borg_exclude_from: [] borg_exclude_from: []
borg_encryption_passcommand: false borg_encryption_passcommand: false
borg_key_export_path: "~/{{ borg_repository }}.key" borg_key_export_path: "/root/borg_keys"
borg_lock_wait_time: 5 borg_lock_wait_time: 5
borg_ssh_key_file_path: "/root/.ssh/{{ borg_ssh_key_name }}" borg_ssh_key_file_path: "/root/.ssh/{{ borg_ssh_key_name }}"
borg_ssh_key_name: borgbackup borg_ssh_key_name: borgbackup

View file

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