Ansible: Backup MySQL

From Glitchdata
Revision as of 18:11, 20 September 2015 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • You can use the mysql_db module or command module.
  • The command module provides more direct and flexible control of the task.

Challenges

  • tarball & compressing

Example

  tasks:
    - name: Backup Site DB
#      command: mysqldump --opt -u{{ db_user }} -p{{ db_pass }} -h{{ db_host }} --add-drop-table --add-drop-database --databases g_database > ~/glitchdata.com/dumpit/database_dump.sql
      mysql_db: login_user={{db_user}} login_host={{db_host}} login_password={{db_pass}} name={{item}} state=dump target={{remote_backup_directory}}ansible_dbdump.sql
      with_items: databases


Links