Skip to content

Commit

Permalink
Add mysqldump_options
Browse files Browse the repository at this point in the history
  • Loading branch information
boutetnico committed Nov 4, 2024
1 parent 3f2bf70 commit 51ea72e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Example Playbook
mysql_endpoint: localhost
mysql_databases:
- site
mysqldump_options: "--get-server-public-key"
cron:
hour: "*/6"
minute: 30
Expand Down
1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
mysql_endpoint: localhost
mysql_databases:
- site
mysqldump_options: "--get-server-public-key"
cron:
hour: "*/6"
minute: 30
Expand Down
5 changes: 4 additions & 1 deletion templates/mysqldump.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 51ea72e

Please sign in to comment.