Add role backup-secrets.

This commit is contained in:
Viyurz 2024-05-14 19:12:39 +02:00
parent 7cea26edff
commit c9bedfa177
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
2 changed files with 23 additions and 0 deletions

View file

@ -3,6 +3,7 @@
roles:
- include-vars
- borg-init
- backup-secrets
- name: Backup project(s)
hosts: localhost

View file

@ -0,0 +1,22 @@
- name:
become: true
block:
- name: Create borg backup
command:
cmd: |
borg create
--compression=lzma
"{{ borg_repodir }}::secrets-{now:%Y-%m-%d_%H-%M-%S}"
{{ playbook_dir }}/../secrets.yml
environment:
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
- name: Prune borg repository
command:
cmd: |
borg prune
--glob-archives='secrets-*'
{{ borg_prune_options }}
{{ borg_repodir }}
environment:
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"