diff --git a/manifests/backup/mysqlbackup.pp b/manifests/backup/mysqlbackup.pp index 730264952..c0bf98b12 100644 --- a/manifests/backup/mysqlbackup.pp +++ b/manifests/backup/mysqlbackup.pp @@ -28,6 +28,7 @@ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', $optional_args = [], $incremental_backups = false, + $install_cron = true, ) inherits mysql::params { mysql_user { "${backupuser}@localhost": @@ -65,12 +66,14 @@ require => Mysql_user["${backupuser}@localhost"], } - if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' { - ensure_packages('crontabs') - } elsif $::osfamily == 'RedHat' { - ensure_packages('cronie') - } elsif $::osfamily != 'FreeBSD' { - ensure_packages('cron') + if $install_cron { + if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' { + ensure_packages('crontabs') + } elsif $::osfamily == 'RedHat' { + ensure_packages('cronie') + } elsif $::osfamily != 'FreeBSD' { + ensure_packages('cron') + } } cron { 'mysqlbackup-weekly': diff --git a/manifests/backup/mysqldump.pp b/manifests/backup/mysqldump.pp index 0fb07b298..c7d842e4b 100644 --- a/manifests/backup/mysqldump.pp +++ b/manifests/backup/mysqldump.pp @@ -29,6 +29,7 @@ $mysqlbackupdir_ensure = 'directory', $mysqlbackupdir_target = undef, $incremental_backups = false, + $install_cron = true, ) inherits mysql::params { unless $::osfamily == 'FreeBSD' { @@ -58,17 +59,13 @@ require => Mysql_user["${backupuser}@localhost"], } - if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' { - package {'crontabs': - ensure => present, - } - } elsif $::osfamily == 'RedHat' { - package {'cronie': - ensure => present, - } - } elsif $::osfamily != 'FreeBSD' { - package {'cron': - ensure => present, + if $install_cron { + if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' { + ensure_packages('crontabs') + } elsif $::osfamily == 'RedHat' { + ensure_packages('cronie') + } elsif $::osfamily != 'FreeBSD' { + ensure_packages('cron') } } diff --git a/manifests/backup/xtrabackup.pp b/manifests/backup/xtrabackup.pp index 305e891d2..f76112bd6 100644 --- a/manifests/backup/xtrabackup.pp +++ b/manifests/backup/xtrabackup.pp @@ -29,7 +29,8 @@ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', $optional_args = [], $additional_cron_args = '--backup', - $incremental_backups = true + $incremental_backups = true, + $install_cron = true, ) inherits mysql::params { ensure_packages($xtrabackup_package_name) @@ -50,6 +51,16 @@ } } + if $install_cron { + if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' { + ensure_packages('crontabs') + } elsif $::osfamily == 'RedHat' { + ensure_packages('cronie') + } elsif $::osfamily != 'FreeBSD' { + ensure_packages('cron') + } + } + if $incremental_backups { # Warn if old backups are removed too soon. Incremental backups will fail # if the full backup is no longer available. diff --git a/manifests/server/backup.pp b/manifests/server/backup.pp index 5cc780fe9..cb7fdea71 100644 --- a/manifests/server/backup.pp +++ b/manifests/server/backup.pp @@ -65,6 +65,8 @@ # Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. # @param optional_args # Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.) +# @param install_cron +# Manage installation of cron package class mysql::server::backup ( $backupuser = undef, $backuppassword = undef, @@ -91,6 +93,7 @@ $maxallowedpacket = '1M', $optional_args = [], $incremental_backups = true, + $install_cron = true, ) inherits mysql::params { if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ { @@ -124,6 +127,7 @@ 'maxallowedpacket' => $maxallowedpacket, 'optional_args' => $optional_args, 'incremental_backups' => $incremental_backups, + 'install_cron' => $install_cron, } }) }