WIP: Export repo key
This commit is contained in:
parent
00f0b60613
commit
3dd71eac1d
2 changed files with 15 additions and 9 deletions
37
tasks/borg.yml
Normal file
37
tasks/borg.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: "Borg | Copy borgmatic configuration"
|
||||
ansible.builtin.template:
|
||||
src: config.yaml.j2
|
||||
dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: "Borg | Add borgmatic cron job"
|
||||
ansible.builtin.cron:
|
||||
name: "{{ borgmatic_timer_cron_name }}"
|
||||
hour: "{{ borgmatic_timer_hour }}"
|
||||
minute: "{{ borgmatic_timer_minute }}"
|
||||
user: "{{ borg_user }}"
|
||||
cron_file: "{{ borgmatic_timer_cron_name }}"
|
||||
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
|
||||
|
||||
- name: "Borg | Init borg repository"
|
||||
ansible.builtin.expect:
|
||||
command: "borgmatic init -e {{ borg_repo_key }}"
|
||||
responses:
|
||||
^.*want to continue connecting.*$: "yes"
|
||||
|
||||
- name: "Borg | Create backup"
|
||||
ansible.builtin.command:
|
||||
cmd: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
|
||||
|
||||
- name: "Borg | Export repo key"
|
||||
ansible.builtin.command:
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue