|
@@ -4,8 +4,12 @@
|
|
|
- name: generate commands
|
|
|
set_fact:
|
|
|
# escape %
|
|
|
+ # $command .= ' | sed \'s/ AUTO_INCREMENT=[0-9]*\b//\'';
|
|
|
backup_command: |-
|
|
|
- ssh -i {{item.ssh_key_path}} {{item.ssh_user}}@{{item.source_host}} /usr/bin/mysqldump --opt --order-by-primary --skip-dump-date {{item.database}} | sed 's$),($),\n($g' >"{{item.target_dir_path}}/$(date -u +'\%Y-\%m-\%dT\%H:\%M:\%SZ').sql"
|
|
|
+ {% if item.source_host is defined %}
|
|
|
+ ssh -i {{item.ssh_key_path}} {{item.ssh_user}}@{{item.source_host}}
|
|
|
+ {%- endif %}
|
|
|
+ /usr/bin/mysqldump --opt --order-by-primary --skip-dump-date {{item.database}} | sed 's$),($),\n($g' >"{{item.target_dir_path}}/$(date -u +'\%Y-\%m-\%dT\%H:\%M:\%SZ').sql"
|
|
|
with_items: '{{mysql_backups}}'
|
|
|
register: mysql_backup_commands
|
|
|
- name: setup cron jobs
|