vps/roles/etebase/tasks/backup.yml

31 lines
889 B
YAML
Raw Normal View History

2024-02-23 12:51:17 +01:00
- name:
become: true
block:
- name: Backup SQLite database
command:
cmd: |
sqlite3
"{{ volumes['etebase_datadir'] }}/db.sqlite3"
".backup {{ volumes['etebase_datadir'] }}/db-backup.sqlite3"
- name: Create borg backup
command:
cmd: |
borg create
--compression=lzma
"{{ borg_repodir }}::{{ role_name }}-{now:%Y-%m-%d_%H-%M-%S}"
{{ volumes['etebase_datadir'] }}/db-backup.sqlite3
{{ volumes['etebase_datadir'] }}/media
environment:
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
- name: Prune borg repository
command:
cmd: |
borg prune
--glob-archives='{{ role_name }}-*'
{{ borg_prune_options }}
{{ borg_repodir }}
environment:
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"