1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-11-14 01:00:34 +00:00

add FreeBSD support

changes for FreeBSD are trivial and mainly relate to
an alternative path to configuration and executable files.
So, the standard way for 3rd-party config files in FreeBSD:
  /usr/local/etc{/rsnapshot}
and for binaries:
  /usr/local
Also, define @cmd_rsnapshot in cron.erb via config_cmd_rsnapshot
This commit is contained in:
olevole 2018-10-14 06:36:46 +03:00
parent 03c31b78c2
commit 4202b1ae94
3 changed files with 29 additions and 13 deletions

View File

@ -190,6 +190,8 @@ class rsnapshot::config (
# create cron files for each backup level # create cron files for each backup level
# merge possible cron definitions to one # merge possible cron definitions to one
$real_cron = deep_merge($rsnapshot::params::cron, $rsnapshot::cron, $hash[cron]) $real_cron = deep_merge($rsnapshot::params::cron, $rsnapshot::cron, $hash[cron])
$cmd_rsnapshot = pick($rsnapshot::cmd_rsnapshot, $rsnapshot::params::config_cmd_rsnapshot)
concat::fragment { "mailto for ${host}": concat::fragment { "mailto for ${host}":
content => "#This file is managed by puppet\nMAILTO=${real_cron[mailto]}\n\n", content => "#This file is managed by puppet\nMAILTO=${real_cron[mailto]}\n\n",
target => $cronfile, target => $cronfile,

View File

@ -3,13 +3,17 @@
# default params # default params
class rsnapshot::params { class rsnapshot::params {
$hosts = undef $hosts = undef
$conf_d = '/etc/rsnapshot' # the place where the host specific configs are stored $conf_d = $::osfamily ? {
'FreeBSD' => '/usr/local/etc/rsnapshot', # the place where the host specific configs are stored
default => '/etc/rsnapshot,' # the place where the host specific configs are stored
}
$config_backup_user = 'root' $config_backup_user = 'root'
$package_name = 'rsnapshot' $package_name = 'rsnapshot'
$package_ensure = 'present' $package_ensure = 'present'
$cron_service_name = $::osfamily ? { $cron_service_name = $::osfamily ? {
'RedHat' => 'crond', 'RedHat' => 'crond',
'Debian' => 'cron', 'Debian' => 'cron',
'FreeBSD' => 'cron',
default => '', default => '',
} }
$manage_cron = true $manage_cron = true
@ -20,11 +24,21 @@ class rsnapshot::params {
$config_check_mk_job = false $config_check_mk_job = false
$config_cmd_cp = '/bin/cp' $config_cmd_cp = '/bin/cp'
$config_cmd_rm = '/bin/rm' $config_cmd_rm = '/bin/rm'
$config_cmd_rsync = '/usr/bin/rsync' $config_cmd_rsync = $::osfamily ? {
'FreeBSD' => '/usr/local/bin/rsync',
default => '/usr/bin/rsync',
}
$config_cmd_ssh = '/usr/bin/ssh' $config_cmd_ssh = '/usr/bin/ssh'
$config_cmd_logger = '/usr/bin/logger' $config_cmd_logger = '/usr/bin/logger'
$config_cmd_du = '/usr/bin/du' $config_cmd_du = '/usr/bin/du'
$config_cmd_rsnapshot_diff = '/usr/bin/rsnapshot-diff' $config_cmd_rsnapshot = $::osfamily ? {
'FreeBSD' => '/usr/local/bin/rsnapshot',
default => '/usr/bin/rsnapshot',
}
$config_cmd_rsnapshot_diff = $::osfamily ? {
'FreeBSD' => '/usr/local/bin/rsnapshot-diff',
default => '/usr/bin/rsnapshot-diff',
}
$config_cmd_preexec = undef $config_cmd_preexec = undef
$config_cmd_postexec = undef $config_cmd_postexec = undef
$config_cronfile_prefix = 'rsnapshot_' $config_cronfile_prefix = 'rsnapshot_'

View File

@ -1 +1 @@
<%= @minute %> <%= @hour %> <%= @monthday %> <%= @month %> <%= @weekday %> root<% if scope['rsnapshot::check_mk_job'] == true -%> mk-job rsnapshot_<%= @host %>_<%= @level %><% end -%> /usr/bin/rsnapshot -c <%= @config %> <%= @level %> <%= @minute %> <%= @hour %> <%= @monthday %> <%= @month %> <%= @weekday %> root<% if scope['rsnapshot::check_mk_job'] == true -%> mk-job rsnapshot_<%= @host %>_<%= @level %><% end -%> <%= @cmd_rsnapshot %> -c <%= @config %> <%= @level %>