Puppet module to backup and restore MySQL databases based on duplicity.
Backup and restore MySQL databases based on duplicity. The modules makes sure a database dump is include in the
referenced duplicity backup and restores this previously taken dump in case the existing database is empty.
Make sure, the parent backup directory (/var/backups
) is properly existing:
file { '/var/backups':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0644',
}
Now you’re ready to manage a database:
duplicity_mysql::database { 'my-database':
profile => 'system',
}
This will create a dump of the MySQL database my-database
each time the backup profile system
is run. The dump will
be keep in the default backup directory. If the database is existing but empty, the dump will be restored. In case the
dump file is missing, Puppet will attempt to restore the file from the last backup.
If you just want to backup the database but don’t restore it, set the ensure
parameter to backup
:
duplicity_mysql::database { 'my-database':
ensure => backup,
profile => 'system',
}
The module has been tested on the following operating systems. Testing and patches for other platforms are welcome.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)