Defined Type: backup::mysqlset
- Defined in:
- modules/backup/manifests/mysqlset.pp
Overview
SPDX-License-Identifier: Apache-2.0
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'modules/backup/manifests/mysqlset.pp', line 2
define backup::mysqlset(
$method = 'bpipe',
$xtrabackup = true,
$per_db = false,
$innodb_only = false,
$binlog = false,
$slave = true,
$local_dump_dir = undef,
$password_file = undef,
$mysql_binary = undef,
$mysqldump_binary = undef,
$jobdefaults = $profile::backup::host::jobdefaults,
) {
$allowed_methods = [ 'bpipe', 'predump' ]
if !($method in $allowed_methods) {
fail("${method} is not allowed")
}
if $method == 'predump' {
$extras = {
'ClientRunBeforeJob' => '/etc/bacula/scripts/predump',
}
$basefileset = regsubst(regsubst($local_dump_dir,'/',''),'/','-','G')
$fileset = "mysql-${basefileset}"
file { '/etc/bacula/scripts/predump':
ensure => present,
owner => 'root',
group => 'root',
mode => '0500',
content => template('backup/mysql-predump.erb'),
}
} elsif $method == 'bpipe' {
bacula::client::mysql_bpipe { "mysql-bpipe-x${xtrabackup}-p${per_db}-i${innodb_only}":
per_database => $per_db,
xtrabackup => $xtrabackup,
mysqldump_innodb_only => $innodb_only,
is_master => $binlog,
is_slave => $slave,
local_dump_dir => $local_dump_dir,
password_file => $password_file,
mysql_binary => $mysql_binary,
mysqldump_binary => $mysqldump_binary,
}
$extras = undef
$fileset = "mysql-${method}-x${xtrabackup}-p${per_db}-i${innodb_only}"
}
if $jobdefaults != undef {
@bacula::client::job { "mysql-${method}-${name}-${jobdefaults}":
fileset => $fileset,
jobdefaults => $jobdefaults,
extras => $extras,
}
$motd_content = "#!/bin/sh\necho \"Backed up MySQL on this host: ${name}\""
@motd::script { "backups-mysql-${name}":
ensure => present,
priority => 6,
content => $motd_content,
tag => 'backup-motd',
}
}
}
|