Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions manifests/backup/mysqlbackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class mysql::backup::mysqlbackup (
$backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
$backupcronuser = $mysql::params::backupcronuser,
$maxallowedpacket = '1M',
$backupdir = '',
$backupdirmode = '0700',
Expand Down Expand Up @@ -84,7 +85,7 @@
cron { 'mysqlbackup-weekly':
ensure => $ensure,
command => 'mysqlbackup backup',
user => 'root',
user => $backupcronuser,
hour => $time[0],
minute => $time[1],
weekday => '0',
Expand All @@ -94,7 +95,7 @@
cron { 'mysqlbackup-daily':
ensure => $ensure,
command => 'mysqlbackup --incremental backup',
user => 'root',
user => $backupcronuser,
hour => $time[0],
minute => $time[1],
weekday => '1-6',
Expand Down
5 changes: 3 additions & 2 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class mysql::backup::mysqldump (
$backupuser = '',
Variant[String, Sensitive[String]] $backuppassword = '',
$backupcronuser = $mysql::params::backupcronuser,
$backupdir = '',
$maxallowedpacket = '1M',
$backupdirmode = '0700',
Expand Down Expand Up @@ -79,7 +80,7 @@
cron { 'mysql-backup':
ensure => $ensure,
command => '/usr/local/sbin/mysqlbackup.sh',
user => 'root',
user => $backupcronuser,
hour => $time[0],
minute => $time[1],
monthday => $time[2],
Expand All @@ -93,7 +94,7 @@
ensure => $ensure,
path => '/usr/local/sbin/mysqlbackup.sh',
mode => '0700',
owner => 'root',
owner => $backupcronuser,
group => $mysql::params::root_group,
content => template('mysql/mysqlbackup.sh.erb'),
}
Expand Down
7 changes: 4 additions & 3 deletions manifests/backup/xtrabackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class mysql::backup::xtrabackup (
$backupuser = undef,
Optional[Variant[String, Sensitive[String]]] $backuppassword = undef,
$backupcronuser = $mysql::params::backupcronuser,
$backupdir = '',
$maxallowedpacket = '1M',
$backupmethod = 'xtrabackup',
Expand Down Expand Up @@ -129,7 +130,7 @@
cron { 'xtrabackup-weekly':
ensure => $ensure,
command => "/usr/local/sbin/xtrabackup.sh --target-dir=${backupdir}/$(date +\\%F)_full ${additional_cron_args}",
user => 'root',
user => $backupcronuser,
hour => $time[0],
minute => $time[1],
weekday => '0',
Expand Down Expand Up @@ -161,7 +162,7 @@
cron { 'xtrabackup-daily':
ensure => $ensure,
command => "/usr/local/sbin/xtrabackup.sh ${daily_cron_data['directories']} ${additional_cron_args}",
user => 'root',
user => $backupcronuser,
hour => $time[0],
minute => $time[1],
weekday => $daily_cron_data['weekday'],
Expand All @@ -180,7 +181,7 @@
ensure => $ensure,
path => '/usr/local/sbin/xtrabackup.sh',
mode => '0700',
owner => 'root',
owner => $backupcronuser,
group => $mysql::params::root_group,
content => template($backupscript_template),
}
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class mysql::params {
$manage_config_file = true
$config_file_mode = '0644'
$backupcronuser = 'root'
$purge_conf_dir = false
$restart = false
$root_password = 'UNSET'
Expand Down
6 changes: 5 additions & 1 deletion manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#
# @param backupuser
# MySQL user to create with backup administrator privileges.
# @param backupcronuser
# User to use for backup cron jobs. Defaults to root.
# @param backuppassword
# Password to create for `backupuser`.
# @param backupdir
Expand Down Expand Up @@ -84,6 +86,7 @@
# Give a list of excluded databases when using file_per_database, e.g.: [ 'information_schema', 'performance_schema' ]
class mysql::server::backup (
$backupuser = undef,
$backupcronuser = $mysql::params::backupcronuser,
Optional[Variant[String, Sensitive[String]]] $backuppassword = undef,
$backupdir = undef,
$backupdirmode = '0700',
Expand Down Expand Up @@ -121,10 +124,11 @@
create_resources('class', {
"mysql::backup::${provider}" => {
'backupuser' => $backupuser,
'backupcronuser' => $backupcronuser,
'backuppassword' => $backuppassword,
'backupdir' => $backupdir,
'backupdirmode' => $backupdirmode,
'backupdirowner' => $backupdirowner,
'backupdirowner' => $backupcronuser,
'backupdirgroup' => $backupdirgroup,
'backupcompress' => $backupcompress,
'backuprotate' => $backuprotate,
Expand Down