mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 01:30:35 +00:00
testing
This commit is contained in:
parent
ed9de1e8cd
commit
396d71cb8e
@ -5,6 +5,7 @@ class rsnapshot::config (
|
||||
$hosts = $rsnapshot::hosts,
|
||||
$cron_dir = $rsnapshot::cron_dir,
|
||||
) {
|
||||
|
||||
# these are global settings, no point in setting them per host
|
||||
$config_version = $rsnapshot::params::config_version
|
||||
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||
@ -33,7 +34,7 @@ class rsnapshot::config (
|
||||
$hosts_clean.each |String $host, $hash | {
|
||||
$backup_user = pick($hash['backup_user'], $rsnapshot::params::config_backup_user)
|
||||
$default_backup_dirs = pick($rsnapshot::default_backup, $rsnapshot::params::config_default_backup)
|
||||
$backup_levels = pick($hash['backup_levels'], $rsnapshot::params::config_backup_levels, 'weekly')
|
||||
$backup_levels = pick($hash['backup_levels'], $rsnapshot::backup_levels, 'weekly')
|
||||
$backup = $hash['backup']
|
||||
$backup_defaults = pick($hash['backup_defaults'], $rsnapshot::params::config_backup_defaults)
|
||||
$cmd_cp = pick($hash['cmd_cp'], $rsnapshot::params::config_cmd_cp)
|
||||
@ -66,9 +67,9 @@ class rsnapshot::config (
|
||||
$one_fs = pick_undef($hash['one_fs'], $rsnapshot::params::config_one_fs)
|
||||
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
||||
$retain = pick_undef($hash['retain'], $rsnapshot::params::config_retain)
|
||||
$include = pick_undef($hash['include'], $rsnapshot::params::config_include)
|
||||
$exclude = pick_undef($hash['exclude'], $rsnapshot::params::config_exclude)
|
||||
$include_file = pick_undef($hash['include_file'], $rsnapshot::params::config_include_file)
|
||||
$include = $hash['include']
|
||||
$exclude = $hash['exclude']
|
||||
$include_file = pick($hash['include_file'], $rsnapshot::params::config_include_file, "${conf_d}/${host}.include")
|
||||
$exclude_file = pick($hash['exclude_file'], $rsnapshot::params::config_exclude_file, "${conf_d}/${host}.exclude")
|
||||
$link_dest = pick_undef($hash['link_dest'], $rsnapshot::params::config_link_dest)
|
||||
$sync_first = pick_undef($hash['sync_first'], $rsnapshot::params::config_sync_first)
|
||||
@ -108,19 +109,26 @@ class rsnapshot::config (
|
||||
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
||||
}
|
||||
|
||||
if $include != '' {
|
||||
file { $include_file:
|
||||
ensure => 'file',
|
||||
content => template('rsnapshot/include.erb'),
|
||||
}
|
||||
$real_include = $rsnapshot::include + $include
|
||||
notify { "$real_include for $host": }
|
||||
if empty($real_include) {
|
||||
notify { "$host $real_include is empty": }
|
||||
} else {
|
||||
# file { $include_file:
|
||||
# ensure => 'file',
|
||||
# content => template('rsnapshot/include.erb'),
|
||||
#}
|
||||
notify { "${host} $real_include is not empty": }
|
||||
}
|
||||
|
||||
if $exclude != '' {
|
||||
|
||||
$real_exclude = $rsnapshot::exclude + $exclude
|
||||
if $real_exclude != '' {
|
||||
file { $exclude_file:
|
||||
ensure => 'file',
|
||||
content => template('rsnapshot/exclude.erb'),
|
||||
}
|
||||
}
|
||||
|
||||
concat { $config:
|
||||
}
|
||||
concat::fragment { "${config} for ${host}":
|
||||
|
@ -14,8 +14,10 @@ class rsnapshot (
|
||||
$package_ensure = $rsnapshot::params::package_ensure,
|
||||
$cron = $rsnapshot::params::cron,
|
||||
$backup_scripts = $rsnapshot::params::backup_scripts,
|
||||
$include = $rsnapshot::params::config_include,
|
||||
$exclude = $rsnapshot::params::config_exclude,
|
||||
$snapshot_root = $rsnapshot::params::config_snapshot_root,
|
||||
$backup_levels = $rsnapshot::params::config_backup_levels,
|
||||
) inherits rsnapshot::params {
|
||||
|
||||
$default_backup_scripts = $rsnapshot::params::backup_scripts + $backup_scripts
|
||||
|
@ -48,8 +48,8 @@ class rsnapshot::params {
|
||||
'weekly' => '4',
|
||||
'monthly' => '6',
|
||||
}
|
||||
$config_include = []
|
||||
$config_exclude = []
|
||||
$config_include = [ ]
|
||||
$config_exclude = [ ]
|
||||
$config_include_file = undef
|
||||
$config_exclude_file = undef
|
||||
$config_link_dest = false
|
||||
|
@ -1,3 +1,3 @@
|
||||
<% @exclude.each do |exc| -%>
|
||||
<% @real_exclude.each do |exc| -%>
|
||||
<%= exc %>
|
||||
<% end %>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<% @include.each do |inc| -%>
|
||||
<% @real_include.each do |inc| -%>
|
||||
<%= inc %>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user