You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/common/templates/backup_mysql_database.sh

17 lines
439 B
Bash

#!/usr/bin/env bash
set -euxo pipefail;
# Arguments
db="$1";
# Variables
file={{ backups_mysql_database_directory | quote }}"/$db/latest.sql.gpg";
# Execution
mysqldump --opt "$db" |
pv --quiet --buffer-size 256M |
gpg --quiet --no-verbose --encrypt --recipient {{ backup_gpg_fingerprint | quote }} --trust-model always > "$file";
chmod u+r-wx,g+r-wx,o+r-wx "$file";
{{ global_helper_directory | quote }}/backup_rename.sh "$file";