vps/roles/postgres/tasks/backup.yml

25 lines
619 B
YAML
Raw Normal View History

2024-03-29 20:56:28 +01:00
- name: Create borg backup from PostgreSQL dumpall
shell: |
docker exec postgres
pg_dumpall |
borg create
--compression lzma
"{{ borg_repodir }}::{{ role_name }}-{now:%Y-%m-%d_%H-%M-%S}"
-
--stdin-name dumpall.sql
environment:
2024-03-30 11:32:39 +01:00
DOCKER_HOST: "{{ docker_host }}"
2024-03-29 20:56:28 +01:00
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
become: true
- name: Prune borg repository
command:
cmd: |
borg prune
--glob-archives='{{ role_name }}-*'
{{ borg_prune_options }}
{{ borg_repodir }}
environment:
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
become: true