mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 09:40:35 +00:00
fix crontabs with dots on debian & added rsnapshot_prefix var
This commit is contained in:
parent
59cdc23ca1
commit
90ee92acb8
@ -31,7 +31,7 @@ class rsnapshot::config (
|
|||||||
|
|
||||||
# custom function, if only a hostname is given as a param, this is an empty hash
|
# custom function, if only a hostname is given as a param, this is an empty hash
|
||||||
# the next loop would break as puppet does not allow to reassign variables
|
# the next loop would break as puppet does not allow to reassign variables
|
||||||
# the function checks $hosts for elements like:
|
# the function checks $hosts for elements like:
|
||||||
# { foo => } and converts those to { foo => {} }
|
# { foo => } and converts those to { foo => {} }
|
||||||
$hosts_clean = assert_empty_hash($hosts)
|
$hosts_clean = assert_empty_hash($hosts)
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class rsnapshot::config (
|
|||||||
content => template('rsnapshot/rsnapshot.erb'),
|
content => template('rsnapshot/rsnapshot.erb'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if has_key($hash, backup_scripts) {
|
if has_key($hash, backup_scripts) {
|
||||||
$hash[backup_scripts].each |$script, $scriptconf| {
|
$hash[backup_scripts].each |$script, $scriptconf| {
|
||||||
@ -158,11 +158,25 @@ class rsnapshot::config (
|
|||||||
content => template("rsnapshot/${script}.sh.erb"),
|
content => template("rsnapshot/${script}.sh.erb"),
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cronfile = "${cron_dir}/${host}"
|
# cron on Debian seems to ignore files that have dots in their name; replace
|
||||||
|
# them with underscores (issue #2)
|
||||||
|
if $::osfamily == 'Debian' {
|
||||||
|
$cron_name = regsubst("${host}", '\.', '_')
|
||||||
|
$cronfile = "${cron_dir}/${rsnapshot_prefix}${cron_name}"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cronfile = "${cron_dir}/${rsnapshot_prefix}${host}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make sure old cron files without rsnapshot_prefix are removed
|
||||||
|
file { "${cron_dir}/${host}":
|
||||||
|
ensure => absent,
|
||||||
|
}
|
||||||
|
|
||||||
concat { $cronfile:
|
concat { $cronfile:
|
||||||
}
|
}
|
||||||
# create cron files for each backup level
|
# create cron files for each backup level
|
||||||
@ -190,4 +204,3 @@ class rsnapshot::config (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ class rsnapshot (
|
|||||||
$snapshot_root = $rsnapshot::params::config_snapshot_root,
|
$snapshot_root = $rsnapshot::params::config_snapshot_root,
|
||||||
$backup_levels = $rsnapshot::params::config_backup_levels,
|
$backup_levels = $rsnapshot::params::config_backup_levels,
|
||||||
$cron_service_name = $rsnapshot::params::cron_service_name,
|
$cron_service_name = $rsnapshot::params::cron_service_name,
|
||||||
|
$rsnapshot_prefix = $rsnapshot::params::config_rsnapshot_prefix,
|
||||||
|
|
||||||
) inherits rsnapshot::params {
|
) inherits rsnapshot::params {
|
||||||
|
|
||||||
$default_backup_scripts = $rsnapshot::params::backup_scripts + $backup_scripts
|
$default_backup_scripts = $rsnapshot::params::backup_scripts + $backup_scripts
|
||||||
@ -32,4 +34,3 @@ class rsnapshot (
|
|||||||
contain '::rsnapshot::service'
|
contain '::rsnapshot::service'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,9 @@ class rsnapshot::params {
|
|||||||
$config_verbose = '2'
|
$config_verbose = '2'
|
||||||
$config_loglevel = '4'
|
$config_loglevel = '4'
|
||||||
$config_stop_on_stale_lockfile = undef # bool
|
$config_stop_on_stale_lockfile = undef # bool
|
||||||
|
$config_rsnapshot_prefix = 'rsnapshot_'
|
||||||
$config_rsync_short_args = '-az'
|
$config_rsync_short_args = '-az'
|
||||||
$config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded
|
$config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded
|
||||||
$config_ssh_args = undef
|
$config_ssh_args = undef
|
||||||
$config_du_args = undef
|
$config_du_args = undef
|
||||||
$config_one_fs = undef
|
$config_one_fs = undef
|
||||||
|
Loading…
Reference in New Issue
Block a user