2024-03-05 11:15:10 +01:00
- name : Backup MySQL database
community.docker.docker_container_exec :
container : hedgedoc-mysql
2024-03-30 11:32:39 +01:00
docker_host : "{{ docker_host }}"
2024-03-05 11:15:10 +01:00
argv :
- /bin/bash
- "-c"
- "mysqldump hedgedoc > /var/lib/mysql/hedgedoc-dump.sql"
env :
MYSQL_PWD : "{{ hedgedoc_secrets['mysql_root_password'] if hedgedoc_secrets['mysql_root_password'] is defined else lookup('ansible.builtin.file', hedgedoc_mysql_root_password_file) }}"
- name : Create borg backup
command :
cmd : |
borg create
--compression=lzma
"{{ borg_repodir }}::{{ role_name }}-{now:%Y-%m-%d_%H-%M-%S}"
{{ volumes['hedgedoc_mysql_datadir'] }}/hedgedoc-dump.sql
environment :
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