diff --git a/Readme.md b/Readme.md index c9057f0..531a70c 100644 --- a/Readme.md +++ b/Readme.md @@ -89,6 +89,7 @@ Example Playbook mysql_endpoint: localhost mysql_databases: - site + mysqldump_options: "--get-server-public-key" cron: hour: "*/6" minute: 30 diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 2e5e53b..cd8950b 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -23,6 +23,7 @@ mysql_endpoint: localhost mysql_databases: - site + mysqldump_options: "--get-server-public-key" cron: hour: "*/6" minute: 30 diff --git a/templates/mysqldump.sh.j2 b/templates/mysqldump.sh.j2 index 4167690..5343caa 100644 --- a/templates/mysqldump.sh.j2 +++ b/templates/mysqldump.sh.j2 @@ -14,6 +14,7 @@ MYSQL_DATABASES=({{ item.vars.mysql_databases | join(' ') }}) MYSQL_ENDPOINT={{ item.vars.mysql_endpoint }} MYSQL_USER={{ item.vars.mysql_user }} MYSQL_PASSWORD={{ item.vars.mysql_password }} +MYSQLDUMP_OPTIONS="{{ item.vars.mysqldump_options | d('') }}" {% for key, value in backup_env.items() %} export {{ key }}={{ value }} @@ -48,7 +49,9 @@ prepare() { mysqldump --host=${MYSQL_ENDPOINT} \ --user=${MYSQL_USER} \ --password=${MYSQL_PASSWORD} \ - --single-transaction ${database} > ${DEST_DIR}/${database}.sql + --single-transaction \ + ${MYSQLDUMP_OPTIONS} \ + ${database} > ${DEST_DIR}/${database}.sql done # Check emptiness