mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2025-09-13 07:49:29 +00:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0ec04544fd | ||
|
905d856219 | ||
|
63214c6919 | ||
|
65f4a883de | ||
|
3043196a2e | ||
|
4202b1ae94 | ||
|
100eafe356 | ||
|
03c31b78c2 | ||
|
679c742fd3 | ||
|
9327c68d59 | ||
|
b72f1dfb36 | ||
|
4820ededfa | ||
|
c7e02c53dd | ||
|
43cd819749 | ||
|
ab20bea159 | ||
|
8aba7d0782 | ||
|
a774e8b360 | ||
|
02b61e2180 | ||
|
063df85094 |
@@ -5,17 +5,16 @@ cache: bundler
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- rvm: 2.1
|
||||
- rvm: 2.3
|
||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||
script: "bundle exec rake validate"
|
||||
- rvm: 2.1
|
||||
- rvm: 2.3
|
||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||
- rvm: 2.1
|
||||
- rvm: 2.3
|
||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||
script: "bundle exec rake beaker"
|
||||
services: docker
|
||||
sudo: required
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
|
@@ -329,7 +329,7 @@ Default is:
|
||||
monthly => {
|
||||
minute => '0..59',
|
||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||
monthday => '0..28',
|
||||
monthday => '1..28',
|
||||
month => '*',
|
||||
weekday => '*',
|
||||
},
|
||||
|
@@ -190,6 +190,8 @@ class rsnapshot::config (
|
||||
# create cron files for each backup level
|
||||
# merge possible cron definitions to one
|
||||
$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}":
|
||||
content => "#This file is managed by puppet\nMAILTO=${real_cron[mailto]}\n\n",
|
||||
target => $cronfile,
|
||||
@@ -197,12 +199,12 @@ class rsnapshot::config (
|
||||
}
|
||||
|
||||
$backup_levels.each |String $level| {
|
||||
$mailto = $real_cron[mailto]
|
||||
$minute = rand_from_array($real_cron[$level][minute], "${host}.${level}.minute")
|
||||
$hour = rand_from_array($real_cron[$level][hour], "${host}.${level}.hour")
|
||||
$monthday = rand_from_array($real_cron[$level][monthday], "${host}.${level}.monthday")
|
||||
$month = rand_from_array($real_cron[$level][month], "${host}.${level}.month")
|
||||
$weekday = rand_from_array($real_cron[$level][weekday], "${host}.${level}.weekday")
|
||||
$mailto = $real_cron[mailto]
|
||||
$minute = rand_from_array($real_cron[$level][minute], "${host}.${level}.minute")
|
||||
$hour = rand_from_array($real_cron[$level][hour], "${host}.${level}.hour")
|
||||
$monthday = rand_from_array($real_cron[$level][monthday], "${host}.${level}.monthday")
|
||||
$month = rand_from_array($real_cron[$level][month], "${host}.${level}.month")
|
||||
$weekday = rand_from_array($real_cron[$level][weekday], "${host}.${level}.weekday")
|
||||
|
||||
concat::fragment { "${host}.${level}":
|
||||
target => $cronfile,
|
||||
|
@@ -13,7 +13,11 @@ class rsnapshot::install {
|
||||
# ensure run directory exists (systemd clears /var/run, so rsnapshot can't create PID files after reboot - issue#12)
|
||||
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||
$tmpfiles_d = '/etc/tmpfiles.d'
|
||||
|
||||
|
||||
file { "${tmpfiles_d}":
|
||||
ensure => directory,
|
||||
}
|
||||
|
||||
file { "${tmpfiles_d}/rsnapshot.conf":
|
||||
ensure => present,
|
||||
content => "D ${lockpath} 0755 root root -",
|
||||
|
@@ -3,14 +3,18 @@
|
||||
# default params
|
||||
class rsnapshot::params {
|
||||
$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'
|
||||
$package_name = 'rsnapshot'
|
||||
$package_ensure = 'present'
|
||||
$cron_service_name = $::osfamily ? {
|
||||
'RedHat' => 'crond',
|
||||
'Debian' => 'cron',
|
||||
default => '',
|
||||
'RedHat' => 'crond',
|
||||
'Debian' => 'cron',
|
||||
'FreeBSD' => 'cron',
|
||||
default => '',
|
||||
}
|
||||
$manage_cron = true
|
||||
$cron_dir = '/etc/cron.d'
|
||||
@@ -20,11 +24,21 @@ class rsnapshot::params {
|
||||
$config_check_mk_job = false
|
||||
$config_cmd_cp = '/bin/cp'
|
||||
$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_logger = '/usr/bin/logger'
|
||||
$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_postexec = undef
|
||||
$config_cronfile_prefix = 'rsnapshot_'
|
||||
@@ -96,7 +110,7 @@ class rsnapshot::params {
|
||||
monthly => {
|
||||
minute => '0..59',
|
||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||
monthday => '0..28',
|
||||
monthday => '1..28',
|
||||
month => '*',
|
||||
weekday => '*',
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "loomsen-rsnapshot",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.4",
|
||||
"author": "loomsen",
|
||||
"summary": "Configures rsnapshot.",
|
||||
"license": "Apache-2.0",
|
||||
@@ -15,7 +15,7 @@
|
||||
"dependencies": [
|
||||
{ "name": "puppetlabs-stdlib","version_requirement": ">= 1.0.0" },
|
||||
{ "name": "stahnma-epel","version_requirement": ">= 1.0.0" },
|
||||
{ "name": "puppetlabs-concat","version_requirement": ">= 2.0.0 < 3.0.0" }
|
||||
{ "name": "puppetlabs-concat","version_requirement": ">= 2.0.0" }
|
||||
],
|
||||
"operatingsystem_support": [
|
||||
{
|
||||
|
@@ -28,6 +28,9 @@ describe 'rsnapshot' do
|
||||
end
|
||||
end
|
||||
context 'files provisioned' do
|
||||
describe file('/etc/tmpfiles.d') do
|
||||
it { should be_directory }
|
||||
end
|
||||
describe file('/etc/tmpfiles.d/rsnapshot.conf') do
|
||||
it { is_expected.to exist }
|
||||
its(:content) { is_expected.to match 'D /var/run/rsnapshot 0755 root root -' }
|
||||
|
@@ -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 %>
|
||||
|
Reference in New Issue
Block a user