Add role backup-secrets.
This commit is contained in:
parent
7cea26edff
commit
c9bedfa177
2 changed files with 23 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
roles:
|
roles:
|
||||||
- include-vars
|
- include-vars
|
||||||
- borg-init
|
- borg-init
|
||||||
|
- backup-secrets
|
||||||
|
|
||||||
- name: Backup project(s)
|
- name: Backup project(s)
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
|
22
roles/backup-secrets/tasks/main.yml
Normal file
22
roles/backup-secrets/tasks/main.yml
Normal 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 }}"
|
Loading…
Reference in a new issue