mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 09:40:35 +00:00
remove package files and minor cleanups
This commit is contained in:
parent
4879f6822f
commit
569f38f606
441
Gemfile.lock
Normal file
441
Gemfile.lock
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/rodjek/rspec-puppet.git
|
||||||
|
revision: 8c1913b2697ee4a60db65607967fbb73226c8bd6
|
||||||
|
specs:
|
||||||
|
rspec-puppet (2.3.0)
|
||||||
|
rspec
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
CFPropertyList (2.2.8)
|
||||||
|
activesupport (4.2.5)
|
||||||
|
i18n (~> 0.7)
|
||||||
|
json (~> 1.7, >= 1.7.7)
|
||||||
|
minitest (~> 5.1)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
|
tzinfo (~> 1.1)
|
||||||
|
addressable (2.4.0)
|
||||||
|
ast (2.2.0)
|
||||||
|
astrolabe (1.3.1)
|
||||||
|
parser (~> 2.2)
|
||||||
|
autoparse (0.3.3)
|
||||||
|
addressable (>= 2.3.1)
|
||||||
|
extlib (>= 0.9.15)
|
||||||
|
multi_json (>= 1.0.0)
|
||||||
|
aws-sdk (1.66.0)
|
||||||
|
aws-sdk-v1 (= 1.66.0)
|
||||||
|
aws-sdk-v1 (1.66.0)
|
||||||
|
json (~> 1.4)
|
||||||
|
nokogiri (>= 1.4.4)
|
||||||
|
backports (3.6.7)
|
||||||
|
beaker (2.31.0)
|
||||||
|
aws-sdk (~> 1.57)
|
||||||
|
beaker-answers (~> 0.0)
|
||||||
|
beaker-hiera (~> 0.0)
|
||||||
|
docker-api
|
||||||
|
fission (~> 0.4)
|
||||||
|
fog (~> 1.25, < 1.35.0)
|
||||||
|
fog-google (~> 0.0.9)
|
||||||
|
google-api-client (~> 0.8)
|
||||||
|
hocon (~> 0.1)
|
||||||
|
inifile (~> 2.0)
|
||||||
|
json (~> 1.8)
|
||||||
|
mime-types (~> 2.99)
|
||||||
|
minitest (~> 5.4)
|
||||||
|
net-scp (~> 1.2)
|
||||||
|
net-ssh (~> 2.9)
|
||||||
|
open_uri_redirections (~> 0.2.1)
|
||||||
|
rbvmomi (~> 1.8)
|
||||||
|
rsync (~> 1.0.9)
|
||||||
|
stringify-hash (~> 0.0)
|
||||||
|
unf (~> 0.1)
|
||||||
|
beaker-answers (0.3.2)
|
||||||
|
require_all (~> 1.3.2)
|
||||||
|
stringify-hash (~> 0.0.0)
|
||||||
|
beaker-hiera (0.1.1)
|
||||||
|
stringify-hash (~> 0.0.0)
|
||||||
|
beaker-puppet_install_helper (0.4.0)
|
||||||
|
beaker (~> 2.0)
|
||||||
|
beaker-rspec (5.3.0)
|
||||||
|
beaker (~> 2.0)
|
||||||
|
rspec
|
||||||
|
serverspec (~> 2)
|
||||||
|
specinfra (~> 2)
|
||||||
|
builder (3.2.2)
|
||||||
|
coderay (1.1.0)
|
||||||
|
colorize (0.7.7)
|
||||||
|
diff-lcs (1.2.5)
|
||||||
|
docile (1.1.5)
|
||||||
|
docker-api (1.24.1)
|
||||||
|
excon (>= 0.38.0)
|
||||||
|
json
|
||||||
|
domain_name (0.5.25)
|
||||||
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
|
ethon (0.8.0)
|
||||||
|
ffi (>= 1.3.0)
|
||||||
|
excon (0.45.4)
|
||||||
|
extlib (0.9.16)
|
||||||
|
facter (2.4.4)
|
||||||
|
CFPropertyList (~> 2.2.6)
|
||||||
|
facterdb (0.3.0)
|
||||||
|
facter
|
||||||
|
jgrep
|
||||||
|
json
|
||||||
|
faraday (0.9.2)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
|
faraday_middleware (0.10.0)
|
||||||
|
faraday (>= 0.7.4, < 0.10)
|
||||||
|
ffi (1.9.10)
|
||||||
|
fission (0.5.0)
|
||||||
|
CFPropertyList (~> 2.2)
|
||||||
|
fog (1.34.0)
|
||||||
|
fog-atmos
|
||||||
|
fog-aws (>= 0.6.0)
|
||||||
|
fog-brightbox (~> 0.4)
|
||||||
|
fog-core (~> 1.32)
|
||||||
|
fog-dynect (~> 0.0.2)
|
||||||
|
fog-ecloud (~> 0.1)
|
||||||
|
fog-google (>= 0.0.2)
|
||||||
|
fog-json
|
||||||
|
fog-local
|
||||||
|
fog-powerdns (>= 0.1.1)
|
||||||
|
fog-profitbricks
|
||||||
|
fog-radosgw (>= 0.0.2)
|
||||||
|
fog-riakcs
|
||||||
|
fog-sakuracloud (>= 0.0.4)
|
||||||
|
fog-serverlove
|
||||||
|
fog-softlayer
|
||||||
|
fog-storm_on_demand
|
||||||
|
fog-terremark
|
||||||
|
fog-vmfusion
|
||||||
|
fog-voxel
|
||||||
|
fog-xml (~> 0.1.1)
|
||||||
|
ipaddress (~> 0.5)
|
||||||
|
nokogiri (~> 1.5, >= 1.5.11)
|
||||||
|
fog-atmos (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-aws (0.7.6)
|
||||||
|
fog-core (~> 1.27)
|
||||||
|
fog-json (~> 1.0)
|
||||||
|
fog-xml (~> 0.1)
|
||||||
|
ipaddress (~> 0.8)
|
||||||
|
fog-brightbox (0.10.1)
|
||||||
|
fog-core (~> 1.22)
|
||||||
|
fog-json
|
||||||
|
inflecto (~> 0.0.2)
|
||||||
|
fog-core (1.35.0)
|
||||||
|
builder
|
||||||
|
excon (~> 0.45)
|
||||||
|
formatador (~> 0.2)
|
||||||
|
fog-dynect (0.0.2)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-xml
|
||||||
|
fog-ecloud (0.3.0)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-google (0.0.9)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-xml
|
||||||
|
fog-json (1.0.2)
|
||||||
|
fog-core (~> 1.0)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
fog-local (0.2.1)
|
||||||
|
fog-core (~> 1.27)
|
||||||
|
fog-powerdns (0.1.1)
|
||||||
|
fog-core (~> 1.27)
|
||||||
|
fog-json (~> 1.0)
|
||||||
|
fog-xml (~> 0.1)
|
||||||
|
fog-profitbricks (0.0.5)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
nokogiri
|
||||||
|
fog-radosgw (0.0.4)
|
||||||
|
fog-core (>= 1.21.0)
|
||||||
|
fog-json
|
||||||
|
fog-xml (>= 0.0.1)
|
||||||
|
fog-riakcs (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-xml
|
||||||
|
fog-sakuracloud (1.7.2)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-serverlove (0.1.2)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-softlayer (1.0.2)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-storm_on_demand (0.1.1)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-terremark (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-vmfusion (0.1.0)
|
||||||
|
fission
|
||||||
|
fog-core
|
||||||
|
fog-voxel (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-xml (0.1.2)
|
||||||
|
fog-core
|
||||||
|
nokogiri (~> 1.5, >= 1.5.11)
|
||||||
|
formatador (0.2.5)
|
||||||
|
gh (0.14.0)
|
||||||
|
addressable
|
||||||
|
backports
|
||||||
|
faraday (~> 0.8)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
net-http-persistent (>= 2.7)
|
||||||
|
net-http-pipeline
|
||||||
|
google-api-client (0.8.6)
|
||||||
|
activesupport (>= 3.2)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
autoparse (~> 0.3)
|
||||||
|
extlib (~> 0.9)
|
||||||
|
faraday (~> 0.9)
|
||||||
|
googleauth (~> 0.3)
|
||||||
|
launchy (~> 2.4)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
retriable (~> 1.4)
|
||||||
|
signet (~> 0.6)
|
||||||
|
googleauth (0.5.0)
|
||||||
|
faraday (~> 0.9)
|
||||||
|
jwt (~> 1.4)
|
||||||
|
logging (~> 2.0)
|
||||||
|
memoist (~> 0.12)
|
||||||
|
multi_json (~> 1.11)
|
||||||
|
signet (~> 0.7)
|
||||||
|
guard (2.13.0)
|
||||||
|
formatador (>= 0.2.4)
|
||||||
|
listen (>= 2.7, <= 4.0)
|
||||||
|
lumberjack (~> 1.0)
|
||||||
|
nenv (~> 0.1)
|
||||||
|
notiffany (~> 0.0)
|
||||||
|
pry (>= 0.9.12)
|
||||||
|
shellany (~> 0.0)
|
||||||
|
thor (>= 0.18.1)
|
||||||
|
guard-rake (1.0.0)
|
||||||
|
guard
|
||||||
|
rake
|
||||||
|
hiera (1.3.4)
|
||||||
|
json_pure
|
||||||
|
highline (1.7.8)
|
||||||
|
hirb (0.7.3)
|
||||||
|
hocon (0.9.3)
|
||||||
|
http-cookie (1.0.2)
|
||||||
|
domain_name (~> 0.5)
|
||||||
|
i18n (0.7.0)
|
||||||
|
inflecto (0.0.2)
|
||||||
|
inifile (2.0.2)
|
||||||
|
ipaddress (0.8.0)
|
||||||
|
jgrep (1.4.0)
|
||||||
|
json
|
||||||
|
json (1.8.3)
|
||||||
|
json_pure (1.8.3)
|
||||||
|
jwt (1.5.2)
|
||||||
|
launchy (2.4.3)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
listen (3.0.5)
|
||||||
|
rb-fsevent (>= 0.9.3)
|
||||||
|
rb-inotify (>= 0.9)
|
||||||
|
little-plugger (1.1.4)
|
||||||
|
logging (2.0.0)
|
||||||
|
little-plugger (~> 1.1)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
lumberjack (1.0.9)
|
||||||
|
memoist (0.14.0)
|
||||||
|
metaclass (0.0.4)
|
||||||
|
metadata-json-lint (0.0.11)
|
||||||
|
json
|
||||||
|
spdx-licenses (~> 1.0)
|
||||||
|
method_source (0.8.2)
|
||||||
|
mime-types (2.99)
|
||||||
|
mini_portile2 (2.0.0)
|
||||||
|
minitest (5.8.3)
|
||||||
|
mocha (1.1.0)
|
||||||
|
metaclass (~> 0.0.1)
|
||||||
|
multi_json (1.11.2)
|
||||||
|
multipart-post (2.0.0)
|
||||||
|
nenv (0.2.0)
|
||||||
|
net-http-persistent (2.9.4)
|
||||||
|
net-http-pipeline (1.0.1)
|
||||||
|
net-scp (1.2.1)
|
||||||
|
net-ssh (>= 2.6.5)
|
||||||
|
net-ssh (2.9.2)
|
||||||
|
net-telnet (0.1.1)
|
||||||
|
netrc (0.11.0)
|
||||||
|
nokogiri (1.6.7.1)
|
||||||
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
|
notiffany (0.0.8)
|
||||||
|
nenv (~> 0.1)
|
||||||
|
shellany (~> 0.0)
|
||||||
|
open_uri_redirections (0.2.1)
|
||||||
|
parser (2.2.3.0)
|
||||||
|
ast (>= 1.1, < 3.0)
|
||||||
|
powerpack (0.1.1)
|
||||||
|
pry (0.9.12.6)
|
||||||
|
coderay (~> 1.0)
|
||||||
|
method_source (~> 0.8)
|
||||||
|
slop (~> 3.4)
|
||||||
|
puppet (3.8.4)
|
||||||
|
facter (> 1.6, < 3)
|
||||||
|
hiera (~> 1.0)
|
||||||
|
json_pure
|
||||||
|
puppet-blacksmith (3.3.1)
|
||||||
|
puppet (>= 2.7.16)
|
||||||
|
rest-client
|
||||||
|
puppet-lint (1.1.0)
|
||||||
|
puppet-lint-absolute_classname-check (0.1.3)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-lint-classes_and_types_beginning_with_digits-check (0.1.0)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-lint-leading_zero-check (0.1.0)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-lint-trailing_comma-check (0.3.1)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-lint-unquoted_string-check (0.2.5)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-lint-version_comparison-check (0.1.2)
|
||||||
|
puppet-lint (~> 1.0)
|
||||||
|
puppet-syntax (2.0.0)
|
||||||
|
rake
|
||||||
|
puppetlabs_spec_helper (1.0.1)
|
||||||
|
mocha
|
||||||
|
puppet-lint
|
||||||
|
puppet-syntax
|
||||||
|
rake
|
||||||
|
rspec-puppet
|
||||||
|
pusher-client (0.6.2)
|
||||||
|
json
|
||||||
|
websocket (~> 1.0)
|
||||||
|
rainbow (2.0.0)
|
||||||
|
rake (10.4.2)
|
||||||
|
rb-fsevent (0.9.6)
|
||||||
|
rb-inotify (0.9.5)
|
||||||
|
ffi (>= 0.5.0)
|
||||||
|
rbvmomi (1.8.2)
|
||||||
|
builder
|
||||||
|
nokogiri (>= 1.4.1)
|
||||||
|
trollop
|
||||||
|
require_all (1.3.3)
|
||||||
|
rest-client (1.8.0)
|
||||||
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
|
mime-types (>= 1.16, < 3.0)
|
||||||
|
netrc (~> 0.7)
|
||||||
|
retriable (1.4.1)
|
||||||
|
rspec (3.1.0)
|
||||||
|
rspec-core (~> 3.1.0)
|
||||||
|
rspec-expectations (~> 3.1.0)
|
||||||
|
rspec-mocks (~> 3.1.0)
|
||||||
|
rspec-core (3.1.7)
|
||||||
|
rspec-support (~> 3.1.0)
|
||||||
|
rspec-expectations (3.1.2)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.1.0)
|
||||||
|
rspec-its (1.2.0)
|
||||||
|
rspec-core (>= 3.0.0)
|
||||||
|
rspec-expectations (>= 3.0.0)
|
||||||
|
rspec-mocks (3.1.3)
|
||||||
|
rspec-support (~> 3.1.0)
|
||||||
|
rspec-puppet-facts (1.3.0)
|
||||||
|
facter
|
||||||
|
facterdb (>= 0.3.0)
|
||||||
|
json
|
||||||
|
puppet
|
||||||
|
rspec-support (3.1.2)
|
||||||
|
rsync (1.0.9)
|
||||||
|
rubocop (0.33.0)
|
||||||
|
astrolabe (~> 1.3)
|
||||||
|
parser (>= 2.2.2.5, < 3.0)
|
||||||
|
powerpack (~> 0.1)
|
||||||
|
rainbow (>= 1.99.1, < 3.0)
|
||||||
|
ruby-progressbar (~> 1.4)
|
||||||
|
ruby-progressbar (1.7.5)
|
||||||
|
serverspec (2.25.0)
|
||||||
|
multi_json
|
||||||
|
rspec (~> 3.0)
|
||||||
|
rspec-its
|
||||||
|
specinfra (~> 2.46)
|
||||||
|
sfl (2.2)
|
||||||
|
shellany (0.0.1)
|
||||||
|
signet (0.7.2)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
faraday (~> 0.9)
|
||||||
|
jwt (~> 1.5)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
simplecov (0.11.1)
|
||||||
|
docile (~> 1.1.0)
|
||||||
|
json (~> 1.8)
|
||||||
|
simplecov-html (~> 0.10.0)
|
||||||
|
simplecov-console (0.2.0)
|
||||||
|
colorize
|
||||||
|
hirb
|
||||||
|
simplecov
|
||||||
|
simplecov-html (0.10.0)
|
||||||
|
slop (3.6.0)
|
||||||
|
spdx-licenses (1.0.0)
|
||||||
|
json
|
||||||
|
specinfra (2.47.0)
|
||||||
|
net-scp
|
||||||
|
net-ssh (>= 2.7, < 3.1)
|
||||||
|
net-telnet
|
||||||
|
sfl
|
||||||
|
stringify-hash (0.0.2)
|
||||||
|
thor (0.19.1)
|
||||||
|
thread_safe (0.3.5)
|
||||||
|
travis (1.8.0)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
backports
|
||||||
|
faraday (~> 0.9)
|
||||||
|
faraday_middleware (~> 0.9, >= 0.9.1)
|
||||||
|
gh (~> 0.13)
|
||||||
|
highline (~> 1.6)
|
||||||
|
launchy (~> 2.1)
|
||||||
|
pry (~> 0.9, < 0.10)
|
||||||
|
pusher-client (~> 0.4)
|
||||||
|
typhoeus (~> 0.6, >= 0.6.8)
|
||||||
|
travis-lint (2.0.0)
|
||||||
|
json
|
||||||
|
trollop (2.1.2)
|
||||||
|
typhoeus (0.8.0)
|
||||||
|
ethon (>= 0.8.0)
|
||||||
|
tzinfo (1.2.2)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
unf (0.1.4)
|
||||||
|
unf_ext
|
||||||
|
unf_ext (0.0.7.1)
|
||||||
|
websocket (1.2.2)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
beaker
|
||||||
|
beaker-puppet_install_helper
|
||||||
|
beaker-rspec
|
||||||
|
guard-rake
|
||||||
|
metadata-json-lint
|
||||||
|
puppet (~> 3.8.0)
|
||||||
|
puppet-blacksmith
|
||||||
|
puppet-lint-absolute_classname-check
|
||||||
|
puppet-lint-classes_and_types_beginning_with_digits-check
|
||||||
|
puppet-lint-leading_zero-check
|
||||||
|
puppet-lint-trailing_comma-check
|
||||||
|
puppet-lint-unquoted_string-check
|
||||||
|
puppet-lint-version_comparison-check
|
||||||
|
puppetlabs_spec_helper
|
||||||
|
rake
|
||||||
|
rspec (< 3.2.0)
|
||||||
|
rspec-puppet!
|
||||||
|
rspec-puppet-facts
|
||||||
|
rubocop (= 0.33.0)
|
||||||
|
simplecov (>= 0.11.0)
|
||||||
|
simplecov-console
|
||||||
|
travis
|
||||||
|
travis-lint
|
2
TODO
2
TODO
@ -1 +1 @@
|
|||||||
validate for puppet 3
|
validate for puppet 3 => impossible, misses the .each function
|
||||||
|
@ -111,7 +111,7 @@ class rsnapshot::config (
|
|||||||
ensure => 'file',
|
ensure => 'file',
|
||||||
}
|
}
|
||||||
file { $config:
|
file { $config:
|
||||||
content => template('rsnapshot/rsnapshot.erb')
|
content => template('rsnapshot/rsnapshot.erb'),
|
||||||
}
|
}
|
||||||
$cronfile = "${cron_dir}/${host}"
|
$cronfile = "${cron_dir}/${host}"
|
||||||
concat { $cronfile:
|
concat { $cronfile:
|
||||||
|
@ -14,13 +14,13 @@ class rsnapshot (
|
|||||||
$package_ensure = $rsnapshot::params::package_ensure,
|
$package_ensure = $rsnapshot::params::package_ensure,
|
||||||
) inherits rsnapshot::params {
|
) inherits rsnapshot::params {
|
||||||
if $::puppetversion =~ /^(1|2|3)/ {
|
if $::puppetversion =~ /^(1|2|3)/ {
|
||||||
fail("This module requires Puppet 4")
|
fail('This module requires Puppet 4')
|
||||||
}
|
}
|
||||||
if $hosts {
|
if $hosts {
|
||||||
class { 'rsnapshot::install': }->
|
class { '::rsnapshot::install': }->
|
||||||
class { 'rsnapshot::config': }
|
class { '::rsnapshot::config': }
|
||||||
contain 'rsnapshot::install'
|
contain '::rsnapshot::install'
|
||||||
contain 'rsnapshot::config'
|
contain '::rsnapshot::config'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "loomsen-rsnapshot",
|
"name": "loomsen-rsnapshot",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"author": "loomsen",
|
"author": "loomsen",
|
||||||
"summary": "Configures rsnapshot.",
|
"summary": "Configures rsnapshot.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
Binary file not shown.
@ -1,135 +0,0 @@
|
|||||||
Checklist (and a short version for the impatient)
|
|
||||||
=================================================
|
|
||||||
|
|
||||||
* Commits:
|
|
||||||
|
|
||||||
- Make commits of logical units.
|
|
||||||
|
|
||||||
- Check for unnecessary whitespace with "git diff --check" before
|
|
||||||
committing.
|
|
||||||
|
|
||||||
- Commit using Unix line endings (check the settings around "crlf" in
|
|
||||||
git-config(1)).
|
|
||||||
|
|
||||||
- Do not check in commented out code or unneeded files.
|
|
||||||
|
|
||||||
- The first line of the commit message should be a short
|
|
||||||
description (50 characters is the soft limit, excluding ticket
|
|
||||||
number(s)), and should skip the full stop.
|
|
||||||
|
|
||||||
- Associate the issue in the message. The first line should include
|
|
||||||
the issue number in the form "(#XXXX) Rest of message".
|
|
||||||
|
|
||||||
- The body should provide a meaningful commit message, which:
|
|
||||||
|
|
||||||
- uses the imperative, present tense: "change", not "changed" or
|
|
||||||
"changes".
|
|
||||||
|
|
||||||
- includes motivation for the change, and contrasts its
|
|
||||||
implementation with the previous behavior.
|
|
||||||
|
|
||||||
- Make sure that you have tests for the bug you are fixing, or
|
|
||||||
feature you are adding.
|
|
||||||
|
|
||||||
- Make sure the test suites passes after your commit:
|
|
||||||
`bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
|
|
||||||
|
|
||||||
- When introducing a new feature, make sure it is properly
|
|
||||||
documented in the README.md
|
|
||||||
|
|
||||||
* Submission:
|
|
||||||
|
|
||||||
* Pre-requisites:
|
|
||||||
|
|
||||||
- Make sure you have a [GitHub account](https://github.com/join)
|
|
||||||
|
|
||||||
* Preferred method:
|
|
||||||
|
|
||||||
- Fork the repository on GitHub.
|
|
||||||
|
|
||||||
- Push your changes to a topic branch in your fork of the
|
|
||||||
repository. (the format ticket/1234-short_description_of_change is
|
|
||||||
usually preferred for this project).
|
|
||||||
|
|
||||||
- Submit a pull request to the repository in the OpenConceptConsulting
|
|
||||||
organization.
|
|
||||||
|
|
||||||
Testing
|
|
||||||
=======
|
|
||||||
|
|
||||||
Getting Started
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
|
|
||||||
package manager such as [bundler](http://bundler.io/) what Ruby packages,
|
|
||||||
or Gems, are required to build, develop, and test this software.
|
|
||||||
|
|
||||||
Please make sure you have [bundler installed](http://bundler.io/#getting-started)
|
|
||||||
on your system, then use it to install all dependencies needed for this project,
|
|
||||||
by running
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% bundle install
|
|
||||||
Fetching gem metadata from https://rubygems.org/........
|
|
||||||
Fetching gem metadata from https://rubygems.org/..
|
|
||||||
Using rake (10.1.0)
|
|
||||||
Using builder (3.2.2)
|
|
||||||
-- 8><-- many more --><8 --
|
|
||||||
Using rspec-system-puppet (2.2.0)
|
|
||||||
Using serverspec (0.6.3)
|
|
||||||
Using rspec-system-serverspec (1.0.0)
|
|
||||||
Using bundler (1.3.5)
|
|
||||||
Your bundle is complete!
|
|
||||||
Use `bundle show [gemname]` to see where a bundled gem is installed.
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE some systems may require you to run this command with sudo.
|
|
||||||
|
|
||||||
If you already have those gems installed, make sure they are up-to-date:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% bundle update
|
|
||||||
```
|
|
||||||
|
|
||||||
With all dependencies in place and up-to-date we can now run the tests:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% rake spec
|
|
||||||
```
|
|
||||||
|
|
||||||
This will execute all the [rspec tests](http://rspec-puppet.com/) tests
|
|
||||||
under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
|
|
||||||
and so on. rspec tests may have the same kind of dependencies as the
|
|
||||||
module they are testing. While the module defines in its [Modulefile](./Modulefile),
|
|
||||||
rspec tests define them in [.fixtures.yml](./fixtures.yml).
|
|
||||||
|
|
||||||
Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
|
|
||||||
tests. These tests spin up a virtual machine under
|
|
||||||
[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
|
|
||||||
[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
|
|
||||||
scenarios. In order to run these, you will need both of those tools
|
|
||||||
installed on your system.
|
|
||||||
|
|
||||||
You can run them by issuing the following command
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% rake spec_clean
|
|
||||||
% rspec spec/acceptance
|
|
||||||
```
|
|
||||||
|
|
||||||
This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
|
|
||||||
install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
|
|
||||||
and then run all the tests under [spec/acceptance](./spec/acceptance).
|
|
||||||
|
|
||||||
Writing Tests
|
|
||||||
-------------
|
|
||||||
|
|
||||||
XXX getting started writing tests.
|
|
||||||
|
|
||||||
Additional Resources
|
|
||||||
====================
|
|
||||||
|
|
||||||
* [General GitHub documentation](http://help.github.com/)
|
|
||||||
|
|
||||||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
||||||
|
|
||||||
group :development, :unit_tests do
|
|
||||||
gem 'rspec-core', '~> 3.1.7', :require => false
|
|
||||||
gem 'rspec-puppet', '~> 2.1', :require => false
|
|
||||||
gem 'puppetlabs_spec_helper', :require => false
|
|
||||||
gem 'simplecov', :require => false
|
|
||||||
gem 'puppet_facts', :require => false
|
|
||||||
gem 'json', :require => false
|
|
||||||
gem 'metadata-json-lint', :require => false
|
|
||||||
gem 'puppet-lint', '< 1.1.0', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
group :system_tests do
|
|
||||||
gem 'beaker-rspec', :require => false
|
|
||||||
gem 'serverspec', :require => false
|
|
||||||
gem 'beaker-puppet_install_helper', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
|
||||||
gem 'facter', facterversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'facter', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
|
||||||
gem 'puppet', puppetversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'puppet', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
# vim:ft=ruby
|
|
@ -1,276 +0,0 @@
|
|||||||
# rsnapshot
|
|
||||||
|
|
||||||
#### Table of Contents
|
|
||||||
|
|
||||||
1. [Overview](#overview)
|
|
||||||
2. [Module Description - What the module does and why it is useful](#module-description)
|
|
||||||
* [Notes](#notes)
|
|
||||||
3. [Setup - The basics of getting started with rsnapshot](#setup)
|
|
||||||
* [What rsnapshot affects](#what-rsnapshot-affects)
|
|
||||||
* [Setup requirements](#setup-requirements)
|
|
||||||
* [Getting started with rsnapshot](#getting-started)
|
|
||||||
4. [Configuration - options and additional functionality](#configuration)
|
|
||||||
* [Examples](#examples)
|
|
||||||
* [More Options](#more-options)
|
|
||||||
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
|
||||||
5. [Limitations - OS compatibility, etc.](#limitations)
|
|
||||||
6. [Development - Guide for contributing to the module](#development)
|
|
||||||
7. [Editors](#editors)
|
|
||||||
8. [Contributors](#contributors)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The rsnapshot module installs, configures and manages rsnapshot on a dedicated backup server.
|
|
||||||
|
|
||||||
## Module Description
|
|
||||||
The rsnapshot module installs, configures and manages rsnapshot on a dedicated backup server. It allows to set up a centralized Backup Server for all your nodes.
|
|
||||||
For the cron setup, the module will pick random time entries for the crons from an Array or a Range of time. For how to configure this, [please see below](#more-options)
|
|
||||||
|
|
||||||
### Notes
|
|
||||||
This module is best used with an ENC like hiera. It will make your config much easier to read and to maintain. Check the examples to see what I mean.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
### What rsnapshot affects
|
|
||||||
|
|
||||||
* This module will install the rsnapshot package on your system
|
|
||||||
* This module will manage the rsnapshot config on your system
|
|
||||||
* This module will manage cron entries for your configured nodes
|
|
||||||
|
|
||||||
### Setup Requirements
|
|
||||||
|
|
||||||
On CentOS Systems this module requires the stahnma-epel module. Also you will need to have rsync installed on all nodes to be backed up.
|
|
||||||
It will create repeatable random cron entries from a configurable timerange for all hosts.
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
You will need to pass the nodenames to be backed up at least.
|
|
||||||
This will pickup all defaults and add localhost to the backups:
|
|
||||||
|
|
||||||
|
|
||||||
```puppet
|
|
||||||
class { '::rsnapshot':
|
|
||||||
hosts => {
|
|
||||||
'localhost' => {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
Here are some more elaborate examples of what you can do with this module.
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
This will backup localhost with defaults. It will disable the default backup locations for example.com
|
|
||||||
and just backup '/var' for example.com.
|
|
||||||
```puppet
|
|
||||||
class { '::rsnapshot':
|
|
||||||
hosts => {
|
|
||||||
'localhost' => {},
|
|
||||||
'example.com' => {
|
|
||||||
backup_defaults => false,
|
|
||||||
backup => {
|
|
||||||
'/var/' => './'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
The same in hiera:
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
classes: rsnapshot
|
|
||||||
rsnapshot::hosts:
|
|
||||||
localhost:
|
|
||||||
example.com:
|
|
||||||
backup_defaults: false
|
|
||||||
backup:
|
|
||||||
'/var/': './'
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A more complete hiera example:
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
classes:
|
|
||||||
- rsnapshot
|
|
||||||
|
|
||||||
# override default backup dirs for all hosts:
|
|
||||||
rsnapshot::default_backup:
|
|
||||||
'/etc': './'
|
|
||||||
'/usr/local': './'
|
|
||||||
'/home': './'
|
|
||||||
|
|
||||||
# configure hosts to be backed up
|
|
||||||
rsnapshot::hosts:
|
|
||||||
# pick all defaults for localhost
|
|
||||||
localhost:
|
|
||||||
# add futher backups for node foo.example.com (additional to default_backup) and use a different snapshot root
|
|
||||||
foo.example.com:
|
|
||||||
backup:
|
|
||||||
'/foo': './'
|
|
||||||
'/bar': './'
|
|
||||||
'/baz': './misc'
|
|
||||||
snapshot_root: '/tmp/rsnapshot'
|
|
||||||
# all defaults
|
|
||||||
foo1.example.com:
|
|
||||||
foo2:
|
|
||||||
# disable default backup dirs and just backup /var for node bar1
|
|
||||||
# also set the minute to 0-10 for daily cron (note: this is not particularly useful, it's just meant to document the features)
|
|
||||||
# lastly set the range of hours to pick a random hour from (the cron for bar1 will have hour set to something between 1 and 5)
|
|
||||||
bar1:
|
|
||||||
backup_defaults: false
|
|
||||||
backup:
|
|
||||||
'/var': './var'
|
|
||||||
cron:
|
|
||||||
'daily':
|
|
||||||
'minute': '0-10'
|
|
||||||
'hour': '1..5'
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### More options
|
|
||||||
The defaults are pretty reasonable, I hope. However, you may override pretty much anything. Available parameters are discussed below.
|
|
||||||
|
|
||||||
#### Specials
|
|
||||||
As mentioned, this module will generate random time entries for your hosts. The random number generator is hashed with hostname and backup_level, so the randomness will be repeatable per host.level. This is important so puppet won't override the crons with each run.
|
|
||||||
You may specify time ranges as follows:
|
|
||||||
* default cron syntax (1-10, '*/5', 5)
|
|
||||||
* an array with allowed values, for example, if you want the backup for a host to run between 1am and 5am, you would override the hours setting for the host in question.
|
|
||||||
in hiera this would look like: (Explanation see below)
|
|
||||||
```yaml
|
|
||||||
rsnapshot::hosts:
|
|
||||||
example.com:
|
|
||||||
cron:
|
|
||||||
'daily':
|
|
||||||
'minute': '1'
|
|
||||||
'hour': '1..5'
|
|
||||||
```
|
|
||||||
This will create the rsnapshot config using defaults from params.pp, but set the minute of the daily backup to '1' and the hour to something random between 1 and 5.
|
|
||||||
So it would look something like:
|
|
||||||
```
|
|
||||||
1 4 * * * foo daily
|
|
||||||
```
|
|
||||||
or maybe
|
|
||||||
```
|
|
||||||
1 2 * * * foo daily
|
|
||||||
```
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
### Classes
|
|
||||||
|
|
||||||
#### Public Classes
|
|
||||||
* rsnapshot: Main class, includes all other classes.
|
|
||||||
|
|
||||||
####Private Classes
|
|
||||||
|
|
||||||
* rsnapshot::install: Handles the packages.
|
|
||||||
* rsnapshot::config: Handles configuration and cron files.
|
|
||||||
* rsnapshot::params: default values.
|
|
||||||
|
|
||||||
### Functions
|
|
||||||
####`assert_empty_hash`
|
|
||||||
Sets an empty value to a hash (we need this so a loop doesn't break if just a hostname is given to pick up all defaults.
|
|
||||||
|
|
||||||
####`pick_undef`
|
|
||||||
Like pick but returns undef values.
|
|
||||||
|
|
||||||
####`rand_from_array`
|
|
||||||
Takes an Integer, a String or an Array as input, and returns a random entry from the array (or just the String/Integer)
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
The following parameters are available in the `::rsnapshot` class:
|
|
||||||
|
|
||||||
####`$hosts`
|
|
||||||
Hash containing the hosts to be backed up and optional overrides per host
|
|
||||||
####`$conf_d`
|
|
||||||
The place where the configs will be dropped (Default: /etc/rsnapshot (will be created if it doesn't exist))
|
|
||||||
####`$config_backup_user`
|
|
||||||
The user to run the backup scripts as (Default: root, also the user used for ssh connections, if you change this make sure you have proper key deployed and the user exists in the nodes to be backed up.)
|
|
||||||
####`$package_name`
|
|
||||||
Default: rsnapshot
|
|
||||||
####`$package_ensure`
|
|
||||||
Default: present
|
|
||||||
####`$cron_dir`
|
|
||||||
Directory to drop the cron files to. Crons will be created per host. (Default: /etc/cron.d)
|
|
||||||
####`$backup_levels`
|
|
||||||
Array containing the backup levels (hourly, daily, weekly, monthly)
|
|
||||||
Configure the backup_levels (valid per host and global, so you may either set: rsnapshot::backup_levels for all hosts or override default backup_levels for specific hosts)
|
|
||||||
####`$backup_defaults`
|
|
||||||
Boolean. Backup default backup dirs or not.
|
|
||||||
####`$cron`
|
|
||||||
Hash. Set time ranges for different backup levels.
|
|
||||||
Hash is of the form:
|
|
||||||
cron =>{
|
|
||||||
daily => {
|
|
||||||
minute => param,
|
|
||||||
hour => param,
|
|
||||||
}
|
|
||||||
weekly => {
|
|
||||||
minute => param,
|
|
||||||
hour => param,
|
|
||||||
}
|
|
||||||
{...}
|
|
||||||
}
|
|
||||||
### rsnapshot configuration variables
|
|
||||||
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
|
|
||||||
####`$cmd_cp`
|
|
||||||
####`$cmd_rm`
|
|
||||||
####`$cmd_rsync`
|
|
||||||
####`$cmd_ssh`
|
|
||||||
####`$cmd_logger`
|
|
||||||
####`$cmd_du`
|
|
||||||
####`$cmd_rsnapshot_diff`
|
|
||||||
####`$cmd_preexec`
|
|
||||||
####`$cmd_postexec`
|
|
||||||
####`$use_lvm`
|
|
||||||
####`$linux_lvm_cmd_lvcreate`
|
|
||||||
####`$linux_lvm_cmd_lvremove`
|
|
||||||
####`$linux_lvm_cmd_mount`
|
|
||||||
####`$linux_lvm_cmd_umount`
|
|
||||||
####`$linux_lvm_snapshotsize`
|
|
||||||
####`$linux_lvm_snapshotname`
|
|
||||||
####`$linux_lvm_vgpath`
|
|
||||||
####`$linux_lvm_mountpath`
|
|
||||||
####`$logpath`
|
|
||||||
####`$logfile`
|
|
||||||
####`$lockpath`
|
|
||||||
####`$snapshot_root`
|
|
||||||
####`$no_create_root`
|
|
||||||
####`$verbose`
|
|
||||||
####`$loglevel`
|
|
||||||
####`$stop_on_stale_lockfile`
|
|
||||||
####`$rsync_short_args`
|
|
||||||
####`$rsync_long_args`
|
|
||||||
####`$ssh_args`
|
|
||||||
####`$du_args`
|
|
||||||
####`$one_fs`
|
|
||||||
####`$retain`
|
|
||||||
####`$interval`
|
|
||||||
####`$include`
|
|
||||||
####`$exclude`
|
|
||||||
####`$include_file`
|
|
||||||
####`$exclude_file`
|
|
||||||
####`$link_dest`
|
|
||||||
####`$sync_first`
|
|
||||||
####`$rsync_numtries`
|
|
||||||
####`$use_lazy_deletes`
|
|
||||||
####`$default_backup`
|
|
||||||
####`$backup_scripts`
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
Currently, this module support CentOS, Fedora (with the bloonix CentOS Repo), Ubuntu and Debian.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
I have limited access to resources and time, so if you think this module is useful, like it, hate it, want to make it better or
|
|
||||||
want it off the face of the planet, feel free to get in touch with me.
|
|
||||||
|
|
||||||
## Editors
|
|
||||||
Norbert Varzariu (loomsen)
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
Please see the [list of contributors.](https://github.com/loomsen/puppet-bloonix_agent/graphs/contributors)
|
|
@ -1,23 +0,0 @@
|
|||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
|
||||||
|
|
||||||
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
|
|
||||||
PuppetLint.configuration.fail_on_warnings = true
|
|
||||||
PuppetLint.configuration.send('relative')
|
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
|
||||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
|
||||||
PuppetLint.configuration.ignore_paths = ["vendor/**/*.pp", "spec/**/*.pp", "pkg/**/*.pp"]
|
|
||||||
|
|
||||||
desc "Validate manifests, templates, and ruby files"
|
|
||||||
task :validate do
|
|
||||||
Dir['manifests/**/*.pp'].each do |manifest|
|
|
||||||
sh "puppet parser validate --noop #{manifest}"
|
|
||||||
end
|
|
||||||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
|
||||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
|
||||||
end
|
|
||||||
Dir['templates/**/*.erb'].each do |template|
|
|
||||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
* create a struct for cron like
|
|
||||||
cron = {
|
|
||||||
daily = {
|
|
||||||
minute =>
|
|
||||||
hour =>
|
|
||||||
}
|
|
||||||
monthly = {
|
|
||||||
minute =>
|
|
||||||
hour =>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"CONTRIBUTING.md": "1d1592146aac11936cfda288a04df0e0",
|
|
||||||
"Gemfile": "1291530f9171164c98d314b359bf1d94",
|
|
||||||
"README.md": "79b9753e608f7413f221c040bc980524",
|
|
||||||
"Rakefile": "53164c731c7c0dee279cbe74fce9371e",
|
|
||||||
"TODO": "0833be6e9308a2f59bbdcbb4c175fa05",
|
|
||||||
"lib/puppet/parser/functions/assert_empty_hash.rb": "69fbc5b1d1f85fdd4d4266154d2f074c",
|
|
||||||
"lib/puppet/parser/functions/pick_undef.rb": "227f605e6442d77311cc7faa77c1d293",
|
|
||||||
"lib/puppet/parser/functions/rand_from_array.rb": "bd6e47f00da29df03f529cacb12635ea",
|
|
||||||
"manifests/config.pp": "0f056c7326cacc11697533097e829eed",
|
|
||||||
"manifests/cron.pp": "e2cde5fdb7dd677e0d97308f55fae765",
|
|
||||||
"manifests/init.pp": "714aa55c4e1a495b522075e77c334fdc",
|
|
||||||
"manifests/install.pp": "fb9ade1c118a3ea8c124584418bd45ad",
|
|
||||||
"manifests/params.pp": "bcffee800748e3ce58ecd2c0f596f94a",
|
|
||||||
"metadata.json": "a0219eb24180c95903cfc7bbe05883f6",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml": "6e8a9cb235318d510f5931e73ac07c05",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-12.04-x86_64-vagrant.yml": "d170363003b078c180a7263f4b34f53c",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml": "2114f58c30427f4c57e1140b1cbdcab9",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-14.04-x86_64-vagrant.yml": "07eedc8f2975ab1c5a5ce28133ef8017",
|
|
||||||
"spec/classes/init_spec.rb": "12aea61c02cc639c7f42a7e988639159",
|
|
||||||
"spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
|
|
||||||
"spec/spec_helper.rb": "f3f775caa765cd5ebec8d307f2b07fc5",
|
|
||||||
"templates/cron.erb": "e9455ec3d623a67de0b3fa62255199f7",
|
|
||||||
"templates/rsnapshot.erb": "28250af764432307b330d1ec579afcca",
|
|
||||||
"tests/init.pp": "289ce3c27eea72b5c648097a23bcea61"
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:assert_empty_hash, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function checks an input struct for undefined hashes in key => hash and assigns {}. This is only a helper function to make a hash.each work if one of the values is undefined
|
|
||||||
EOS
|
|
||||||
)do |args|
|
|
||||||
fail "Must receive one argument." if args.empty?
|
|
||||||
args.each do |arg|
|
|
||||||
h = Hash.new
|
|
||||||
arg.each_pair do |host, hash|
|
|
||||||
unless hash.is_a? Hash
|
|
||||||
hash = {}
|
|
||||||
end
|
|
||||||
h[host] = hash
|
|
||||||
end
|
|
||||||
return h
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,15 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:pick_undef, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function is similar to pick_default, but will return or undefined values.
|
|
||||||
EOS
|
|
||||||
) do |args|
|
|
||||||
fail "Must receive at least one argument." if args.empty?
|
|
||||||
default = args.last
|
|
||||||
args = args[0..-2].compact
|
|
||||||
# args.delete(:undef)
|
|
||||||
# args.delete(:undefined)
|
|
||||||
# args.delete("")
|
|
||||||
args << default
|
|
||||||
return args[0]
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,37 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:rand_from_array, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function takes either an int or an array as input and returns the int or a
|
|
||||||
random element from the array
|
|
||||||
EOS
|
|
||||||
)do |args|
|
|
||||||
fail "Must receive two argument." if args.empty?
|
|
||||||
#++ this works if the input is an array
|
|
||||||
# return args.sample
|
|
||||||
# +++++++++++++++++++++++++++++++++++++
|
|
||||||
# args.flatten!
|
|
||||||
params = []
|
|
||||||
params << args[0]
|
|
||||||
params.flatten!
|
|
||||||
arr = []
|
|
||||||
salt = args[1].sum % 60
|
|
||||||
rnd = Random.new(salt)
|
|
||||||
# rnd = Random.new()
|
|
||||||
params.each do |key|
|
|
||||||
if key.is_a?(String) and key =~ /\d\.\.\d/
|
|
||||||
k = key.split('..')
|
|
||||||
r = Range.new(k[0],k[1]).to_a
|
|
||||||
arr << r
|
|
||||||
arr.flatten!
|
|
||||||
elsif key.is_a?(String)
|
|
||||||
arr << key
|
|
||||||
arr.flatten!
|
|
||||||
elsif key.is_a?(Integer)
|
|
||||||
arr << key.to_s
|
|
||||||
arr.flatten!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
last_i = arr.length - 1
|
|
||||||
return arr[rnd.rand(0..last_i)]
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,146 +0,0 @@
|
|||||||
# == Class: rsnapshot::config
|
|
||||||
#
|
|
||||||
# manage host configs
|
|
||||||
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)
|
|
||||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d)
|
|
||||||
# make sure lock path and conf path exist
|
|
||||||
file { $conf_d:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
file { $lockpath:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
file { $cron_dir:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
# 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 function checks $hosts for elements like:
|
|
||||||
# { foo => } and converts those to { foo => {} }
|
|
||||||
$hosts_clean = assert_empty_hash($hosts)
|
|
||||||
|
|
||||||
$hosts_clean.each |String $host, Hash $hash | {
|
|
||||||
$snapshot_root = pick($hash['snapshot_root'], $rsnapshot::params::config_snapshot_root)
|
|
||||||
$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 = $hash['backup']
|
|
||||||
$backup_defaults = pick($hash['backup_defaults'], $rsnapshot::params::config_backup_defaults)
|
|
||||||
$cmd_cp = pick($hash['cmd_cp'], $rsnapshot::params::config_cmd_cp)
|
|
||||||
$cmd_rm = pick($hash['cmd_rm'], $rsnapshot::params::config_cmd_rm)
|
|
||||||
$cmd_rsync = pick($hash['cmd_rsync'], $rsnapshot::params::config_cmd_rsync)
|
|
||||||
$cmd_ssh = pick($hash['cmd_ssh'], $rsnapshot::params::config_cmd_ssh)
|
|
||||||
$cmd_logger = pick($hash['cmd_logger'], $rsnapshot::params::config_cmd_logger)
|
|
||||||
$cmd_du = pick($hash['cmd_du'], $rsnapshot::params::config_cmd_du)
|
|
||||||
$cmd_rsnapshot_diff = pick_undef($hash['cmd_rsnapshot_diff'], $rsnapshot::params::config_cmd_rsnapshot_diff)
|
|
||||||
$cmd_preexec = pick_undef($hash['cmd_preexec'], $rsnapshot::params::config_cmd_preexec)
|
|
||||||
$cmd_postexec = pick_undef($hash['cmd_postexec'], $rsnapshot::params::config_cmd_postexec)
|
|
||||||
$use_lvm = pick_undef($hash['use_lvm'], $rsnapshot::params::config_use_lvm)
|
|
||||||
$linux_lvm_cmd_lvcreate = pick_undef($hash['linux_lvm_cmd_lvcreate'], $rsnapshot::params::config_linux_lvm_cmd_lvcreate)
|
|
||||||
$linux_lvm_cmd_lvremove = pick_undef($hash['linux_lvm_cmd_lvremove'], $rsnapshot::params::config_linux_lvm_cmd_lvremove)
|
|
||||||
$linux_lvm_cmd_mount = pick_undef($hash['linux_lvm_cmd_mount'], $rsnapshot::params::config_linux_lvm_cmd_mount)
|
|
||||||
$linux_lvm_cmd_umount = pick_undef($hash['linux_lvm_cmd_umount'], $rsnapshot::params::config_linux_lvm_cmd_umount)
|
|
||||||
$linux_lvm_snapshotsize = pick_undef($hash['linux_lvm_snapshotsize'], $rsnapshot::params::config_linux_lvm_snapshotsize)
|
|
||||||
$linux_lvm_snapshotname = pick_undef($hash['linux_lvm_snapshotname'], $rsnapshot::params::config_linux_lvm_snapshotname)
|
|
||||||
$linux_lvm_vgpath = pick_undef($hash['linux_lvm_vgpath'], $rsnapshot::params::config_linux_lvm_vgpath)
|
|
||||||
$linux_lvm_mountpath = pick_undef($hash['linux_lvm_mountpath'], $rsnapshot::params::config_linux_lvm_mountpath)
|
|
||||||
$no_create_root = pick_undef($hash['no_create_root'], $rsnapshot::params::config_no_create_root)
|
|
||||||
$logpath = pick($hash['logpath'], $rsnapshot::logpath, $rsnapshot::params::config_logpath)
|
|
||||||
$verbose = pick($hash['verbose'], $rsnapshot::params::config_verbose)
|
|
||||||
$loglevel = pick($hash['loglevel'], $rsnapshot::params::config_loglevel)
|
|
||||||
$stop_on_stale_lockfile = pick_undef($hash['stop_on_stale_lockfile'], $rsnapshot::params::config_stop_on_stale_lockfile)
|
|
||||||
$rsync_short_args = pick($hash['rsync_short_args'], $rsnapshot::params::config_rsync_short_args)
|
|
||||||
$rsync_long_args = pick_undef($hash['rsync_long_args'], $rsnapshot::params::config_rsync_long_args)
|
|
||||||
$ssh_args = pick_undef($hash['ssh_args'], $rsnapshot::params::config_ssh_args)
|
|
||||||
$du_args = pick_undef($hash['du_args'], $rsnapshot::params::config_du_args)
|
|
||||||
$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)
|
|
||||||
$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)
|
|
||||||
$use_lazy_deletes = pick_undef($hash['use_lazy_deletes'], $rsnapshot::params::config_use_lazy_deletes)
|
|
||||||
$rsync_numtries = pick_undef($hash['rsync_numtries'], $rsnapshot::params::config_rsync_numtries)
|
|
||||||
$backup_scripts = pick_undef($hash['backup_scripts'], $rsnapshot::params::config_backup_scripts)
|
|
||||||
|
|
||||||
$snapshot_dir = "${config_snapshot_root}/${host}"
|
|
||||||
$config = "${conf_d}/${host}.rsnapshot.conf"
|
|
||||||
$lockfile = "${lockpath}/${host}.pid"
|
|
||||||
$logfile = "${logpath}/${host}.log"
|
|
||||||
|
|
||||||
# fail if $backup_defaults is set to false and no $host[backup] defined
|
|
||||||
if ! $backup_defaults and ! $backup {
|
|
||||||
fail("==> Configuration error: backup_defaults is ${backup_defaults} and backup definitions for this host don't exist <==")
|
|
||||||
}
|
|
||||||
|
|
||||||
# merge the backup hashes to one if backup_default is set (defaults to true)
|
|
||||||
if $backup_defaults {
|
|
||||||
$backups = merge($backup, $default_backup_dirs)
|
|
||||||
} else {
|
|
||||||
$backups = $backup
|
|
||||||
}
|
|
||||||
|
|
||||||
# one of both interval or retain must be present
|
|
||||||
if ! ( $interval and $retain ) {
|
|
||||||
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
|
||||||
}
|
|
||||||
# rsnapshot wants numeric values
|
|
||||||
if $link_dest {
|
|
||||||
$link_dest_num = bool2num($link_dest)
|
|
||||||
}
|
|
||||||
if $sync_first {
|
|
||||||
$sync_first_num = bool2num($sync_first)
|
|
||||||
}
|
|
||||||
if $use_lazy_deletes {
|
|
||||||
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
|
||||||
}
|
|
||||||
|
|
||||||
file { $exclude_file:
|
|
||||||
ensure => file,
|
|
||||||
}
|
|
||||||
file { $config:
|
|
||||||
content => template('rsnapshot/rsnapshot.erb')
|
|
||||||
}
|
|
||||||
|
|
||||||
$cronfile = "/tmp/rsnapshot.d/cron/${host}"
|
|
||||||
concat { "${cronfile}":
|
|
||||||
}
|
|
||||||
$backup_levels.each |String $level| {
|
|
||||||
if validate_hash($hash) {
|
|
||||||
# allow to globally override ranges, create random numbers for backup_levels daily, weekly, monthly
|
|
||||||
if has_key($host, 'cron'){
|
|
||||||
$c_min = pick($host['cron'][$level]['minute'], $rsnapshot::params::cron[$level]['minute'], '*')
|
|
||||||
$c_hour = pick($host['cron'][$level]['hour'], $rsnapshot::params::cron[$level]['hour'], '*')
|
|
||||||
$c_monthday = pick($host['cron'][$level]['monthday'], $rsnapshot::params::cron[$level]['monthday'], '*')
|
|
||||||
$c_month = pick($host['cron'][$level]['month'], $rsnapshot::params::cron[$level]['month'], '*')
|
|
||||||
$c_weekday = pick($host['cron'][$level]['weekday'], $rsnapshot::params::cron[$level]['weekday'], '*')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$c_min = $rsnapshot::params::cron[$level]['minute']
|
|
||||||
$c_hour = $rsnapshot::params::cron[$level]['hour']
|
|
||||||
$c_monthday = $rsnapshot::params::cron[$level]['monthday']
|
|
||||||
$c_month = $rsnapshot::params::cron[$level]['month']
|
|
||||||
$c_weekday = $rsnapshot::params::cron[$level]['weekday']
|
|
||||||
}
|
|
||||||
$minute = rand_from_array($c_min, "${host}.${level}")
|
|
||||||
$hour = rand_from_array($c_hour, "${host}.${level}")
|
|
||||||
$monthday = rand_from_array($c_monthday, "${host}.${level}")
|
|
||||||
$month = rand_from_array($c_month, "${host}.${level}")
|
|
||||||
$weekday = rand_from_array($c_weekday, "${host}.${level}")
|
|
||||||
concat::fragment { "${host}.${level}":
|
|
||||||
target => "${cronfile}",
|
|
||||||
content => template('rsnapshot/cron.erb'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
# this class sets up cron
|
|
||||||
# * todo
|
|
||||||
# let the user specify a range of hours and randomize cron creation in this range use rand for #args and return arg[rand]
|
|
||||||
|
|
||||||
class rsnapshot::cron {
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
# == Class: rsnapshot
|
|
||||||
#
|
|
||||||
# Manages rsnapshot.
|
|
||||||
#
|
|
||||||
# === Parameters
|
|
||||||
#
|
|
||||||
class rsnapshot (
|
|
||||||
$hosts = $rsnapshot::params::hosts,
|
|
||||||
$conf_d = $rsnapshot::params::conf_d,
|
|
||||||
$logpath = $rsnapshot::params::config_logpath,
|
|
||||||
$lockpath = $rsnapshot::params::config_lockpath,
|
|
||||||
$default_backup = $rsnapshot::params::config_default_backup,
|
|
||||||
$package_name = $rsnapshot::params::package_name,
|
|
||||||
$package_ensure = $rsnapshot::params::package_ensure,
|
|
||||||
) inherits rsnapshot::params {
|
|
||||||
if $hosts {
|
|
||||||
class { 'rsnapshot::install': }->
|
|
||||||
class { 'rsnapshot::config': }
|
|
||||||
contain 'rsnapshot::install'
|
|
||||||
contain 'rsnapshot::config'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
# == Class: rsnapshot::install
|
|
||||||
#
|
|
||||||
# Installs the rsnapshot package.
|
|
||||||
class rsnapshot::install inherits rsnapshot {
|
|
||||||
case $::operatingsystem {
|
|
||||||
/^CentOS$/: { include epel }
|
|
||||||
default: {}
|
|
||||||
}
|
|
||||||
package { $rsnapshot::package_name:
|
|
||||||
ensure => $rsnapshot::package_ensure,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
# == Class: rsnapshot
|
|
||||||
#
|
|
||||||
# default params
|
|
||||||
class rsnapshot::params {
|
|
||||||
$hosts = undef
|
|
||||||
$conf_d = '/tmp/rsnapshot.d' # the place where the host specific configs are stored
|
|
||||||
$config_backup_user = 'root'
|
|
||||||
$package_name = 'rsnapshot'
|
|
||||||
$package_ensure = 'present'
|
|
||||||
$cron_dir = '/tmp/rsnapshot.d/cron'
|
|
||||||
$config_backup_levels = [ 'daily', 'weekly', ]
|
|
||||||
$config_backup_defaults = true
|
|
||||||
$config_version = '1.2'
|
|
||||||
$config_cmd_cp = '/bin/cp'
|
|
||||||
$config_cmd_rm = '/bin/rm'
|
|
||||||
$config_cmd_rsync = '/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_preexec = undef
|
|
||||||
$config_cmd_postexec = undef
|
|
||||||
$config_use_lvm = undef
|
|
||||||
$config_linux_lvm_cmd_lvcreate = undef # '/sbin/lvcreate'
|
|
||||||
$config_linux_lvm_cmd_lvremove = undef # '/sbin/lvremove'
|
|
||||||
$config_linux_lvm_cmd_mount = undef # '/sbin/mount'
|
|
||||||
$config_linux_lvm_cmd_umount = undef # '/sbin/umount'
|
|
||||||
$config_linux_lvm_snapshotsize = undef # '100M'
|
|
||||||
$config_linux_lvm_snapshotname = undef # 'rsnapshot'
|
|
||||||
$config_linux_lvm_vgpath = undef # '/dev'
|
|
||||||
$config_linux_lvm_mountpath = undef # '/mount/rsnapshot'
|
|
||||||
$config_logpath = '/var/log/rsnapshot'
|
|
||||||
$config_logfile = '/var/log/rsnapshot.log' # unused, we are logging to $logpath/$host.log
|
|
||||||
$config_lockpath = '/var/run/rsnapshot'
|
|
||||||
$config_snapshot_root = '/backup/'
|
|
||||||
$config_no_create_root = undef # bool, true or false
|
|
||||||
$config_verbose = '2'
|
|
||||||
$config_loglevel = '4'
|
|
||||||
$config_stop_on_stale_lockfile = undef # bool
|
|
||||||
$config_rsync_short_args = '-az'
|
|
||||||
$config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded
|
|
||||||
$config_ssh_args = undef
|
|
||||||
$config_du_args = undef
|
|
||||||
$config_one_fs = undef
|
|
||||||
$config_retain = { }
|
|
||||||
$config_interval = {
|
|
||||||
'daily' => '7',
|
|
||||||
'weekly' => '4',
|
|
||||||
'monthly' => '6',
|
|
||||||
}
|
|
||||||
$config_include = []
|
|
||||||
$config_exclude = []
|
|
||||||
$config_include_file = undef
|
|
||||||
$config_exclude_file = undef
|
|
||||||
$config_link_dest = false
|
|
||||||
$config_sync_first = false
|
|
||||||
$config_rsync_numtries = 1
|
|
||||||
$config_use_lazy_deletes = false
|
|
||||||
$config_default_backup = {
|
|
||||||
'/etc' => './',
|
|
||||||
'/home' => './',
|
|
||||||
}
|
|
||||||
$config_backup_scripts = {}
|
|
||||||
$cron = {
|
|
||||||
'hourly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '*', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
'daily' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
'weekly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '0..6',
|
|
||||||
},
|
|
||||||
'monthly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '0..28',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "loomsen-rsnapshot",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"author": "loomsen",
|
|
||||||
"summary": "Configures rsnapshot.",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"source": "https://github.com/loomsen/puppet-rsnapshot",
|
|
||||||
"project_page": "https://github.com/loomsen/puppet-rsnapshot",
|
|
||||||
"issues_url": "https://github.com/loomsen/puppet-rsnapshot/issues",
|
|
||||||
"dependencies": [
|
|
||||||
{"name":"puppetlabs-stdlib"},
|
|
||||||
{"name":"stahnma-epel"}
|
|
||||||
],
|
|
||||||
"data_provider": null,
|
|
||||||
"tags": [
|
|
||||||
"rsnapshot",
|
|
||||||
"backup",
|
|
||||||
"rsync"
|
|
||||||
],
|
|
||||||
"requirements": [
|
|
||||||
{
|
|
||||||
"name": "pe",
|
|
||||||
"version_requirement": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "puppet",
|
|
||||||
"version_requirement": ">= 3.0.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"operatingsystem_support": [
|
|
||||||
{
|
|
||||||
"operatingsystem": "CentOS",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"5",
|
|
||||||
"6",
|
|
||||||
"7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Debian",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"6",
|
|
||||||
"7",
|
|
||||||
"8"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Ubuntu",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"12.04",
|
|
||||||
"10.04",
|
|
||||||
"14.04"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Fedora",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"17",
|
|
||||||
"18",
|
|
||||||
"19",
|
|
||||||
"20",
|
|
||||||
"21",
|
|
||||||
"22",
|
|
||||||
"23",
|
|
||||||
"24"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1204-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-12.04-amd64
|
|
||||||
hypervisor : docker
|
|
||||||
image: ubuntu:12.04
|
|
||||||
# This stops the image from being deleted on completion, speeding up the process.
|
|
||||||
docker_preserve_image: true
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1204-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-12.04-amd64
|
|
||||||
hypervisor : vagrant
|
|
||||||
box : puppetlabs/ubuntu-12.04-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor : docker
|
|
||||||
image: ubuntu:14.04
|
|
||||||
# This stops the image from being deleted on completion, speeding up the process.
|
|
||||||
docker_preserve_image: true
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor : vagrant
|
|
||||||
box : puppetlabs/ubuntu-14.04-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,37 +0,0 @@
|
|||||||
require 'spec_helper'
|
|
||||||
describe 'rsnapshot' do
|
|
||||||
|
|
||||||
{'Ubuntu' => 'Debian', 'Debian' => 'Debian'}.each do |system, family|
|
|
||||||
context "when on system #{system} no lvm" do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when on system #{system} with lvm" do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:params) { {:use_lvm => true} }
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('/etc/rsnapshot.conf').with_content(/^linux_lvm_((\w|_)+)\t(.*)$/)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
--format
|
|
||||||
s
|
|
||||||
--colour
|
|
||||||
--loadby
|
|
||||||
mtime
|
|
||||||
--backtrace
|
|
@ -1,29 +0,0 @@
|
|||||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
|
||||||
|
|
||||||
RSpec.configure do |c|
|
|
||||||
c.include PuppetlabsSpec::Files
|
|
||||||
|
|
||||||
c.before :each do
|
|
||||||
# Ensure that we don't accidentally cache facts and environment
|
|
||||||
# between test cases.
|
|
||||||
Facter::Util::Loader.any_instance.stubs(:load_all)
|
|
||||||
Facter.clear
|
|
||||||
Facter.clear_messages
|
|
||||||
|
|
||||||
# Store any environment variables away to be restored later
|
|
||||||
@old_env = {}
|
|
||||||
ENV.each_key {|k| @old_env[k] = ENV[k]}
|
|
||||||
|
|
||||||
if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
|
|
||||||
Puppet.settings[:strict_variables]=true
|
|
||||||
end
|
|
||||||
if ENV['PARSER']
|
|
||||||
Puppet.settings[:parser]=ENV['PARSER']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
c.after :each do
|
|
||||||
PuppetlabsSpec::Files.cleanup
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
<%= @minute %> <%= @hour %> <%= @month %> <%= @monthday %> <%= @weekday %> root /usr/bin/rsnapshot -c <%= @config %> <%= @level %>
|
|
@ -1,144 +0,0 @@
|
|||||||
# This file is being managed by puppet
|
|
||||||
# Module 'rsnaphost'
|
|
||||||
|
|
||||||
config_version <%= @config_version %>
|
|
||||||
snapshot_root <%= @snapshot_root %>
|
|
||||||
<% if @no_create_root != '' -%>
|
|
||||||
no_create_root <%= @no_create_root %>
|
|
||||||
<% end -%>
|
|
||||||
cmd_rsync <%= @cmd_rsync %>
|
|
||||||
<% if @cmd_cp != '' -%>
|
|
||||||
cmd_cp <%= @cmd_cp %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_rm != '' -%>
|
|
||||||
cmd_rm <%= @cmd_rm %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_ssh != '' -%>
|
|
||||||
cmd_ssh <%= @cmd_ssh %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_logger != '' -%>
|
|
||||||
cmd_logger <%= @cmd_logger %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_du != '' -%>
|
|
||||||
cmd_du <%= @cmd_du %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_rsnapshot_diff != '' -%>
|
|
||||||
cmd_rsnapshot_diff <%= @cmd_rsnapshot_diff %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_preexec != '' -%>
|
|
||||||
cmd_preexec <%= @cmd_preexec %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_postexec != '' -%>
|
|
||||||
cmd_postexec <%= @cmd_postexec %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lvm != '' -%>
|
|
||||||
<% if @linux_lvm_cmd_lvcreate -%>
|
|
||||||
linux_lvm_cmd_lvcreate <%= @linux_lvm_cmd_lvcreate %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_lvremove != '' -%>
|
|
||||||
linux_lvm_cmd_lvremove <%= @linux_lvm_cmd_lvremove %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_mount != '' -%>
|
|
||||||
linux_lvm_cmd_mount <%= @linux_lvm_cmd_mount %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_umount != '' -%>
|
|
||||||
linux_lvm_cmd_umount <%= @linux_lvm_cmd_umount %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
#########################################
|
|
||||||
# BACKUP INTERVALS #
|
|
||||||
# Must be unique and in ascending order #
|
|
||||||
# i.e. hourly, daily, weekly, etc. #
|
|
||||||
#########################################
|
|
||||||
<%if @interval != '' -%>
|
|
||||||
<% @interval.each_pair do |name, time| -%>
|
|
||||||
interval <%= name %> <%= time %>
|
|
||||||
<% end -%>
|
|
||||||
<% else %>
|
|
||||||
<% @retain.each_pair do |name, time| -%>
|
|
||||||
retain <%= name %> <%= time %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
verbose <%= @verbose %>
|
|
||||||
loglevel <%= @loglevel %>
|
|
||||||
<% if @logfile != '' -%>
|
|
||||||
logfile <%= @logfile %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @lockfile != '' -%>
|
|
||||||
lockfile <%= @lockfile %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @stop_on_stale_lockfile != '' -%>
|
|
||||||
stop_on_stale_lockfile <%= @stop_on_stale_lockfile %>
|
|
||||||
<%end-%>
|
|
||||||
<% if @rsync_short_args != '' -%>
|
|
||||||
rsync_short_args <%= @rsync_short_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @rsync_long_args != '' -%>
|
|
||||||
rsync_long_args <%= @rsync_long_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @ssh_args != '' -%>
|
|
||||||
ssh_args <%= @ssh_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @du_args != '' -%>
|
|
||||||
du_args <%= @du_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @one_fs != '' %>
|
|
||||||
one_fs <%= @one_fs_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @include != '' %>
|
|
||||||
<% @include.each do |pattern| -%>
|
|
||||||
include <%= pattern %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
<% if @exclude != '' %>
|
|
||||||
<% @exclude.each do |pattern| -%>
|
|
||||||
exclude <%= pattern %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
<% if @include_file != '' -%>
|
|
||||||
include_file <%= @include_file %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @exclude_file != '' -%>
|
|
||||||
exclude_file <%= @exclude_file %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @link_dest != '' -%>
|
|
||||||
link_dest <%= @link_dest_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @sync_first != '' -%>
|
|
||||||
sync_first <%= @sync_first_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lazy_deletes != '' -%>
|
|
||||||
use_lazy_deletes <%= @use_lazy_deletes_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @rsync_numtries != '' -%>
|
|
||||||
rsync_numtries <%= @rsync_numtries %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lvm != '' -%>
|
|
||||||
<% if @linux_lvm_snapshotsize -%>
|
|
||||||
linux_lvm_snapshotsize <%= @linux_lvm_snapshotsize %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_snapshotname != '' -%>
|
|
||||||
linux_lvm_snapshotname <%= @linux_lvm_snapshotname %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_vgpath != '' -%>
|
|
||||||
linux_lvm_vgpath <%= @linux_lvm_vgpath %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_mountpath != '' -%>
|
|
||||||
linux_lvm_mountpath <%= @linux_lvm_mountpath %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
<% @backups.each_pair do |source, dest| -%>
|
|
||||||
<% if @host == 'localhost' -%>
|
|
||||||
backup <%= source %> <%=dest%>
|
|
||||||
<% elsif @backup_user != '' -%>
|
|
||||||
backup <%= @backup_user %>@<%=@host%>:<%= source %> <%=dest%>
|
|
||||||
<% else -%>
|
|
||||||
backup <%=@host%>:<%= source %> <%=dest%>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
<% if @backup_scripts != '' -%>
|
|
||||||
<% @backup_scripts.each_pair do |source, dest| -%>
|
|
||||||
backup_script <%= source %> <%= dest %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
# The baseline for module testing used by Puppet Labs is that each manifest
|
|
||||||
# should have a corresponding test manifest that declares that class or defined
|
|
||||||
# type.
|
|
||||||
#
|
|
||||||
# Tests are then run by using puppet apply --noop (to check for compilation
|
|
||||||
# errors and view a log of events) or by fully applying the test in a virtual
|
|
||||||
# environment (to compare the resulting system state to the desired state).
|
|
||||||
#
|
|
||||||
# Learn more about module testing here:
|
|
||||||
# http://docs.puppetlabs.com/guides/tests_smoke.html
|
|
||||||
#
|
|
||||||
include rsnapshot
|
|
Binary file not shown.
@ -1,135 +0,0 @@
|
|||||||
Checklist (and a short version for the impatient)
|
|
||||||
=================================================
|
|
||||||
|
|
||||||
* Commits:
|
|
||||||
|
|
||||||
- Make commits of logical units.
|
|
||||||
|
|
||||||
- Check for unnecessary whitespace with "git diff --check" before
|
|
||||||
committing.
|
|
||||||
|
|
||||||
- Commit using Unix line endings (check the settings around "crlf" in
|
|
||||||
git-config(1)).
|
|
||||||
|
|
||||||
- Do not check in commented out code or unneeded files.
|
|
||||||
|
|
||||||
- The first line of the commit message should be a short
|
|
||||||
description (50 characters is the soft limit, excluding ticket
|
|
||||||
number(s)), and should skip the full stop.
|
|
||||||
|
|
||||||
- Associate the issue in the message. The first line should include
|
|
||||||
the issue number in the form "(#XXXX) Rest of message".
|
|
||||||
|
|
||||||
- The body should provide a meaningful commit message, which:
|
|
||||||
|
|
||||||
- uses the imperative, present tense: "change", not "changed" or
|
|
||||||
"changes".
|
|
||||||
|
|
||||||
- includes motivation for the change, and contrasts its
|
|
||||||
implementation with the previous behavior.
|
|
||||||
|
|
||||||
- Make sure that you have tests for the bug you are fixing, or
|
|
||||||
feature you are adding.
|
|
||||||
|
|
||||||
- Make sure the test suites passes after your commit:
|
|
||||||
`bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
|
|
||||||
|
|
||||||
- When introducing a new feature, make sure it is properly
|
|
||||||
documented in the README.md
|
|
||||||
|
|
||||||
* Submission:
|
|
||||||
|
|
||||||
* Pre-requisites:
|
|
||||||
|
|
||||||
- Make sure you have a [GitHub account](https://github.com/join)
|
|
||||||
|
|
||||||
* Preferred method:
|
|
||||||
|
|
||||||
- Fork the repository on GitHub.
|
|
||||||
|
|
||||||
- Push your changes to a topic branch in your fork of the
|
|
||||||
repository. (the format ticket/1234-short_description_of_change is
|
|
||||||
usually preferred for this project).
|
|
||||||
|
|
||||||
- Submit a pull request to the repository in the OpenConceptConsulting
|
|
||||||
organization.
|
|
||||||
|
|
||||||
Testing
|
|
||||||
=======
|
|
||||||
|
|
||||||
Getting Started
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
|
|
||||||
package manager such as [bundler](http://bundler.io/) what Ruby packages,
|
|
||||||
or Gems, are required to build, develop, and test this software.
|
|
||||||
|
|
||||||
Please make sure you have [bundler installed](http://bundler.io/#getting-started)
|
|
||||||
on your system, then use it to install all dependencies needed for this project,
|
|
||||||
by running
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% bundle install
|
|
||||||
Fetching gem metadata from https://rubygems.org/........
|
|
||||||
Fetching gem metadata from https://rubygems.org/..
|
|
||||||
Using rake (10.1.0)
|
|
||||||
Using builder (3.2.2)
|
|
||||||
-- 8><-- many more --><8 --
|
|
||||||
Using rspec-system-puppet (2.2.0)
|
|
||||||
Using serverspec (0.6.3)
|
|
||||||
Using rspec-system-serverspec (1.0.0)
|
|
||||||
Using bundler (1.3.5)
|
|
||||||
Your bundle is complete!
|
|
||||||
Use `bundle show [gemname]` to see where a bundled gem is installed.
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE some systems may require you to run this command with sudo.
|
|
||||||
|
|
||||||
If you already have those gems installed, make sure they are up-to-date:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% bundle update
|
|
||||||
```
|
|
||||||
|
|
||||||
With all dependencies in place and up-to-date we can now run the tests:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% rake spec
|
|
||||||
```
|
|
||||||
|
|
||||||
This will execute all the [rspec tests](http://rspec-puppet.com/) tests
|
|
||||||
under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
|
|
||||||
and so on. rspec tests may have the same kind of dependencies as the
|
|
||||||
module they are testing. While the module defines in its [Modulefile](./Modulefile),
|
|
||||||
rspec tests define them in [.fixtures.yml](./fixtures.yml).
|
|
||||||
|
|
||||||
Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
|
|
||||||
tests. These tests spin up a virtual machine under
|
|
||||||
[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
|
|
||||||
[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
|
|
||||||
scenarios. In order to run these, you will need both of those tools
|
|
||||||
installed on your system.
|
|
||||||
|
|
||||||
You can run them by issuing the following command
|
|
||||||
|
|
||||||
```shell
|
|
||||||
% rake spec_clean
|
|
||||||
% rspec spec/acceptance
|
|
||||||
```
|
|
||||||
|
|
||||||
This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
|
|
||||||
install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
|
|
||||||
and then run all the tests under [spec/acceptance](./spec/acceptance).
|
|
||||||
|
|
||||||
Writing Tests
|
|
||||||
-------------
|
|
||||||
|
|
||||||
XXX getting started writing tests.
|
|
||||||
|
|
||||||
Additional Resources
|
|
||||||
====================
|
|
||||||
|
|
||||||
* [General GitHub documentation](http://help.github.com/)
|
|
||||||
|
|
||||||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
||||||
|
|
||||||
group :development, :unit_tests do
|
|
||||||
gem 'rspec-core', '~> 3.1.7', :require => false
|
|
||||||
gem 'rspec-puppet', '~> 2.1', :require => false
|
|
||||||
gem 'puppetlabs_spec_helper', :require => false
|
|
||||||
gem 'simplecov', :require => false
|
|
||||||
gem 'puppet_facts', :require => false
|
|
||||||
gem 'json', :require => false
|
|
||||||
gem 'metadata-json-lint', :require => false
|
|
||||||
gem 'puppet-lint', '< 1.1.0', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
group :system_tests do
|
|
||||||
gem 'beaker-rspec', :require => false
|
|
||||||
gem 'serverspec', :require => false
|
|
||||||
gem 'beaker-puppet_install_helper', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
|
||||||
gem 'facter', facterversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'facter', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
|
||||||
gem 'puppet', puppetversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'puppet', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
# vim:ft=ruby
|
|
@ -1,305 +0,0 @@
|
|||||||
# rsnapshot
|
|
||||||
|
|
||||||
#### Table of Contents
|
|
||||||
|
|
||||||
1. [Overview](#overview)
|
|
||||||
2. [Module Description - What the module does and why it is useful](#module-description)
|
|
||||||
* [Notes](#notes)
|
|
||||||
3. [Setup - The basics of getting started with rsnapshot](#setup)
|
|
||||||
* [What rsnapshot affects](#what-rsnapshot-affects)
|
|
||||||
* [Setup requirements](#setup-requirements)
|
|
||||||
* [Getting started with rsnapshot](#getting-started)
|
|
||||||
4. [Configuration - options and additional functionality](#configuration)
|
|
||||||
* [Examples](#examples)
|
|
||||||
* [More Options](#more-options)
|
|
||||||
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
|
||||||
5. [Limitations - OS compatibility, etc.](#limitations)
|
|
||||||
6. [Development - Guide for contributing to the module](#development)
|
|
||||||
7. [Editors](#editors)
|
|
||||||
8. [Contributors](#contributors)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The rsnapshot module installs, configures and manages rsnapshot on a dedicated backup server.
|
|
||||||
|
|
||||||
## Module Description
|
|
||||||
The rsnapshot module installs, configures and manages rsnapshot on a dedicated backup server. It allows to set up a centralized Backup Server for all your nodes.
|
|
||||||
For the cron setup, the module will pick random time entries for the crons from an Array or a Range of time. For how to configure this, [please see below](#more-options)
|
|
||||||
|
|
||||||
### Notes
|
|
||||||
This module is best used with an ENC like hiera. It will make your config much easier to read and to maintain. Check the examples to see what I mean.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
### What rsnapshot affects
|
|
||||||
|
|
||||||
* This module will install the rsnapshot package on your system
|
|
||||||
* This module will manage the rsnapshot config on your system
|
|
||||||
* This module will manage cron entries for your configured nodes
|
|
||||||
|
|
||||||
### Setup Requirements
|
|
||||||
|
|
||||||
On CentOS Systems this module requires the stahnma-epel module. Also you will need to have rsync installed on all nodes to be backed up.
|
|
||||||
It will create repeatable random cron entries from a configurable timerange for all hosts.
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
You will need to pass the nodenames to be backed up at least.
|
|
||||||
This will pickup all defaults and add localhost to the backups:
|
|
||||||
|
|
||||||
|
|
||||||
```puppet
|
|
||||||
class { '::rsnapshot':
|
|
||||||
hosts => {
|
|
||||||
'localhost' => {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
Here are some more elaborate examples of what you can do with this module.
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
This will backup localhost with defaults. It will disable the default backup locations for example.com
|
|
||||||
and just backup '/var' for example.com.
|
|
||||||
```puppet
|
|
||||||
class { '::rsnapshot':
|
|
||||||
hosts => {
|
|
||||||
'localhost' => {},
|
|
||||||
'example.com' => {
|
|
||||||
backup_defaults => false,
|
|
||||||
backup => {
|
|
||||||
'/var/' => './'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
The same in hiera:
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
classes: rsnapshot
|
|
||||||
rsnapshot::hosts:
|
|
||||||
localhost:
|
|
||||||
example.com:
|
|
||||||
backup_defaults: false
|
|
||||||
backup:
|
|
||||||
'/var/': './'
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A more complete hiera example:
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
classes:
|
|
||||||
- rsnapshot
|
|
||||||
|
|
||||||
# override default backup dirs for all hosts:
|
|
||||||
rsnapshot::default_backup:
|
|
||||||
'/etc': './'
|
|
||||||
'/usr/local': './'
|
|
||||||
'/home': './'
|
|
||||||
|
|
||||||
# configure hosts to be backed up
|
|
||||||
rsnapshot::hosts:
|
|
||||||
# pick all defaults for localhost
|
|
||||||
localhost:
|
|
||||||
# add futher backups for node foo.example.com (additional to default_backup) and use a different snapshot root
|
|
||||||
foo.example.com:
|
|
||||||
backup:
|
|
||||||
'/foo': './'
|
|
||||||
'/bar': './'
|
|
||||||
'/baz': './misc'
|
|
||||||
snapshot_root: '/tmp/rsnapshot'
|
|
||||||
# all defaults
|
|
||||||
foo1.example.com:
|
|
||||||
foo2:
|
|
||||||
# disable default backup dirs and just backup /var for node bar1
|
|
||||||
# also set the minute to 0-10 for daily cron (note: this is not particularly useful, it's just meant to document the features)
|
|
||||||
# lastly set the range of hours to pick a random hour from (the cron for bar1 will have hour set to something between 1 and 5)
|
|
||||||
bar1:
|
|
||||||
backup_defaults: false
|
|
||||||
backup:
|
|
||||||
'/var': './var'
|
|
||||||
cron:
|
|
||||||
'daily':
|
|
||||||
'minute': '0-10'
|
|
||||||
'hour': '1..5'
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### More options
|
|
||||||
The defaults are pretty reasonable, I hope. However, you may override pretty much anything. Available parameters are discussed below.
|
|
||||||
|
|
||||||
#### Specials
|
|
||||||
As mentioned, this module will generate random time entries for your hosts. The random number generator is hashed with hostname and backup_level, so the randomness will be repeatable per host.level. This is important so puppet won't override the crons with each run.
|
|
||||||
You may specify time ranges as follows:
|
|
||||||
* default cron syntax (1-10, '*/5', 5)
|
|
||||||
* an array with allowed values, for example, if you want the backup for a host to run between 1am and 5am, you would override the hours setting for the host in question.
|
|
||||||
in hiera this would look like: (Explanation see below)
|
|
||||||
```yaml
|
|
||||||
rsnapshot::hosts:
|
|
||||||
example.com:
|
|
||||||
cron:
|
|
||||||
'daily':
|
|
||||||
'minute': '1'
|
|
||||||
'hour': '1..5'
|
|
||||||
```
|
|
||||||
This will create the rsnapshot config using defaults from params.pp, but set the minute of the daily backup to '1' and the hour to something random between 1 and 5.
|
|
||||||
So it would look something like:
|
|
||||||
```
|
|
||||||
1 4 * * * foo daily
|
|
||||||
```
|
|
||||||
or maybe
|
|
||||||
```
|
|
||||||
1 2 * * * foo daily
|
|
||||||
```
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
### Classes
|
|
||||||
|
|
||||||
#### Public Classes
|
|
||||||
* rsnapshot: Main class, includes all other classes.
|
|
||||||
|
|
||||||
####Private Classes
|
|
||||||
|
|
||||||
* rsnapshot::install: Handles the packages.
|
|
||||||
* rsnapshot::config: Handles configuration and cron files.
|
|
||||||
* rsnapshot::params: default values.
|
|
||||||
|
|
||||||
### Functions
|
|
||||||
####`assert_empty_hash`
|
|
||||||
Sets an empty value to a hash (we need this so a loop doesn't break if just a hostname is given to pick up all defaults.
|
|
||||||
|
|
||||||
####`pick_undef`
|
|
||||||
Like pick but returns undef values.
|
|
||||||
|
|
||||||
####`rand_from_array`
|
|
||||||
Takes an Integer, a String or an Array as input, and returns a random entry from the array (or just the String/Integer)
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
The following parameters are available in the `::rsnapshot` class:
|
|
||||||
|
|
||||||
####`$hosts`
|
|
||||||
Hash containing the hosts to be backed up and optional overrides per host
|
|
||||||
####`$conf_d`
|
|
||||||
The place where the configs will be dropped (Default: /etc/rsnapshot (will be created if it doesn't exist))
|
|
||||||
####`$backup_user`
|
|
||||||
The user to run the backup scripts as (Default: root, also the user used for ssh connections, if you change this make sure you have proper key deployed and the user exists in the nodes to be backed up.)
|
|
||||||
####`$package_name`
|
|
||||||
Default: rsnapshot
|
|
||||||
####`$package_ensure`
|
|
||||||
Default: present
|
|
||||||
####`$cron_dir`
|
|
||||||
Directory to drop the cron files to. Crons will be created per host. (Default: /etc/cron.d)
|
|
||||||
####`$backup_levels`
|
|
||||||
Array containing the backup levels (hourly, daily, weekly, monthly)
|
|
||||||
Configure the backup_levels (valid per host and global, so you may either set: rsnapshot::backup_levels for all hosts or override default backup_levels for specific hosts)
|
|
||||||
####`$backup_defaults`
|
|
||||||
Boolean. Backup default backup dirs or not.
|
|
||||||
####`$cron`
|
|
||||||
Hash. Set time ranges for different backup levels.
|
|
||||||
Hash is of the form:
|
|
||||||
```puppet
|
|
||||||
cron =>{
|
|
||||||
daily => {
|
|
||||||
minute => param,
|
|
||||||
hour => param,
|
|
||||||
}
|
|
||||||
weekly => {
|
|
||||||
minute => param,
|
|
||||||
hour => param,
|
|
||||||
}
|
|
||||||
{...}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
####`$snapshot_root`
|
|
||||||
global. the directory holding your backups. you will end up with a structure like:
|
|
||||||
```
|
|
||||||
/backup/
|
|
||||||
├── example.com
|
|
||||||
│ ├── daily.0
|
|
||||||
│ ├── daily.1
|
|
||||||
│ ├── daily.2
|
|
||||||
│ ├── daily.3
|
|
||||||
│ ├── weekly.0
|
|
||||||
│ ├── weekly.1
|
|
||||||
│ ├── weekly.2
|
|
||||||
│ └── weekly.3
|
|
||||||
└── localhost
|
|
||||||
├── daily.0
|
|
||||||
├── daily.1
|
|
||||||
├── daily.2
|
|
||||||
└── weekly.0
|
|
||||||
```
|
|
||||||
|
|
||||||
####`$default_backup`
|
|
||||||
The default backup directories (may be set per host, even though there is not much sense in doing so)
|
|
||||||
Default is:
|
|
||||||
```puppet
|
|
||||||
default_backup => {
|
|
||||||
'/etc' => './',
|
|
||||||
'/home' => './',
|
|
||||||
}
|
|
||||||
```
|
|
||||||
### rsnapshot configuration variables
|
|
||||||
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
|
|
||||||
####`$cmd_cp`
|
|
||||||
####`$cmd_rm`
|
|
||||||
####`$cmd_rsync`
|
|
||||||
####`$cmd_ssh`
|
|
||||||
####`$cmd_logger`
|
|
||||||
####`$cmd_du`
|
|
||||||
####`$cmd_rsnapshot_diff`
|
|
||||||
####`$cmd_preexec`
|
|
||||||
####`$cmd_postexec`
|
|
||||||
####`$use_lvm`
|
|
||||||
####`$linux_lvm_cmd_lvcreate`
|
|
||||||
####`$linux_lvm_cmd_lvremove`
|
|
||||||
####`$linux_lvm_cmd_mount`
|
|
||||||
####`$linux_lvm_cmd_umount`
|
|
||||||
####`$linux_lvm_snapshotsize`
|
|
||||||
####`$linux_lvm_snapshotname`
|
|
||||||
####`$linux_lvm_vgpath`
|
|
||||||
####`$linux_lvm_mountpath`
|
|
||||||
####`$logpath`
|
|
||||||
####`$logfile`
|
|
||||||
####`$lockpath`
|
|
||||||
####`$no_create_root`
|
|
||||||
####`$verbose`
|
|
||||||
####`$loglevel`
|
|
||||||
####`$stop_on_stale_lockfile`
|
|
||||||
####`$rsync_short_args`
|
|
||||||
####`$rsync_long_args`
|
|
||||||
####`$ssh_args`
|
|
||||||
####`$du_args`
|
|
||||||
####`$one_fs`
|
|
||||||
####`$retain`
|
|
||||||
####`$interval`
|
|
||||||
####`$include`
|
|
||||||
####`$exclude`
|
|
||||||
####`$include_file`
|
|
||||||
####`$exclude_file`
|
|
||||||
####`$link_dest`
|
|
||||||
####`$sync_first`
|
|
||||||
####`$rsync_numtries`
|
|
||||||
####`$use_lazy_deletes`
|
|
||||||
####`$backup_scripts`
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
Currently, this module support CentOS, Fedora (with the bloonix CentOS Repo), Ubuntu and Debian.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
I have limited access to resources and time, so if you think this module is useful, like it, hate it, want to make it better or
|
|
||||||
want it off the face of the planet, feel free to get in touch with me.
|
|
||||||
|
|
||||||
## Editors
|
|
||||||
Norbert Varzariu (loomsen)
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
Please see the [list of contributors.](https://github.com/loomsen/puppet-bloonix_agent/graphs/contributors)
|
|
@ -1,23 +0,0 @@
|
|||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
|
||||||
|
|
||||||
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
|
|
||||||
PuppetLint.configuration.fail_on_warnings = true
|
|
||||||
PuppetLint.configuration.send('relative')
|
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
|
||||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
|
||||||
PuppetLint.configuration.ignore_paths = ["vendor/**/*.pp", "spec/**/*.pp", "pkg/**/*.pp"]
|
|
||||||
|
|
||||||
desc "Validate manifests, templates, and ruby files"
|
|
||||||
task :validate do
|
|
||||||
Dir['manifests/**/*.pp'].each do |manifest|
|
|
||||||
sh "puppet parser validate --noop #{manifest}"
|
|
||||||
end
|
|
||||||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
|
||||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
|
||||||
end
|
|
||||||
Dir['templates/**/*.erb'].each do |template|
|
|
||||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"CONTRIBUTING.md": "1d1592146aac11936cfda288a04df0e0",
|
|
||||||
"Gemfile": "1291530f9171164c98d314b359bf1d94",
|
|
||||||
"README.md": "f8aa8b62e3137cd2e42b99d853b32c0b",
|
|
||||||
"Rakefile": "53164c731c7c0dee279cbe74fce9371e",
|
|
||||||
"TODO": "d41d8cd98f00b204e9800998ecf8427e",
|
|
||||||
"lib/puppet/parser/functions/assert_empty_hash.rb": "69fbc5b1d1f85fdd4d4266154d2f074c",
|
|
||||||
"lib/puppet/parser/functions/pick_undef.rb": "227f605e6442d77311cc7faa77c1d293",
|
|
||||||
"lib/puppet/parser/functions/rand_from_array.rb": "bd6e47f00da29df03f529cacb12635ea",
|
|
||||||
"manifests/config.pp": "6d84bac803bf0b143d3d75837a038cea",
|
|
||||||
"manifests/cron.pp": "e2cde5fdb7dd677e0d97308f55fae765",
|
|
||||||
"manifests/init.pp": "714aa55c4e1a495b522075e77c334fdc",
|
|
||||||
"manifests/install.pp": "fb9ade1c118a3ea8c124584418bd45ad",
|
|
||||||
"manifests/params.pp": "de10018211fa504d698fa980d2f1a65b",
|
|
||||||
"metadata.json": "9e568b31809ee9caba45a3ae805e9e0d",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml": "6e8a9cb235318d510f5931e73ac07c05",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-12.04-x86_64-vagrant.yml": "d170363003b078c180a7263f4b34f53c",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml": "2114f58c30427f4c57e1140b1cbdcab9",
|
|
||||||
"spec/acceptance/nodesets/ubuntu-14.04-x86_64-vagrant.yml": "07eedc8f2975ab1c5a5ce28133ef8017",
|
|
||||||
"spec/classes/init_spec.rb": "12aea61c02cc639c7f42a7e988639159",
|
|
||||||
"spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
|
|
||||||
"spec/spec_helper.rb": "f3f775caa765cd5ebec8d307f2b07fc5",
|
|
||||||
"templates/cron.erb": "e9455ec3d623a67de0b3fa62255199f7",
|
|
||||||
"templates/rsnapshot.erb": "28250af764432307b330d1ec579afcca",
|
|
||||||
"tests/init.pp": "289ce3c27eea72b5c648097a23bcea61"
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:assert_empty_hash, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function checks an input struct for undefined hashes in key => hash and assigns {}. This is only a helper function to make a hash.each work if one of the values is undefined
|
|
||||||
EOS
|
|
||||||
)do |args|
|
|
||||||
fail "Must receive one argument." if args.empty?
|
|
||||||
args.each do |arg|
|
|
||||||
h = Hash.new
|
|
||||||
arg.each_pair do |host, hash|
|
|
||||||
unless hash.is_a? Hash
|
|
||||||
hash = {}
|
|
||||||
end
|
|
||||||
h[host] = hash
|
|
||||||
end
|
|
||||||
return h
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,15 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:pick_undef, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function is similar to pick_default, but will return or undefined values.
|
|
||||||
EOS
|
|
||||||
) do |args|
|
|
||||||
fail "Must receive at least one argument." if args.empty?
|
|
||||||
default = args.last
|
|
||||||
args = args[0..-2].compact
|
|
||||||
# args.delete(:undef)
|
|
||||||
# args.delete(:undefined)
|
|
||||||
# args.delete("")
|
|
||||||
args << default
|
|
||||||
return args[0]
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,37 +0,0 @@
|
|||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:rand_from_array, :type => :rvalue, :doc => <<-EOS
|
|
||||||
This function takes either an int or an array as input and returns the int or a
|
|
||||||
random element from the array
|
|
||||||
EOS
|
|
||||||
)do |args|
|
|
||||||
fail "Must receive two argument." if args.empty?
|
|
||||||
#++ this works if the input is an array
|
|
||||||
# return args.sample
|
|
||||||
# +++++++++++++++++++++++++++++++++++++
|
|
||||||
# args.flatten!
|
|
||||||
params = []
|
|
||||||
params << args[0]
|
|
||||||
params.flatten!
|
|
||||||
arr = []
|
|
||||||
salt = args[1].sum % 60
|
|
||||||
rnd = Random.new(salt)
|
|
||||||
# rnd = Random.new()
|
|
||||||
params.each do |key|
|
|
||||||
if key.is_a?(String) and key =~ /\d\.\.\d/
|
|
||||||
k = key.split('..')
|
|
||||||
r = Range.new(k[0],k[1]).to_a
|
|
||||||
arr << r
|
|
||||||
arr.flatten!
|
|
||||||
elsif key.is_a?(String)
|
|
||||||
arr << key
|
|
||||||
arr.flatten!
|
|
||||||
elsif key.is_a?(Integer)
|
|
||||||
arr << key.to_s
|
|
||||||
arr.flatten!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
last_i = arr.length - 1
|
|
||||||
return arr[rnd.rand(0..last_i)]
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,148 +0,0 @@
|
|||||||
# == Class: rsnapshot::config
|
|
||||||
#
|
|
||||||
# manage host configs
|
|
||||||
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)
|
|
||||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d)
|
|
||||||
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::params::config_snapshot_root)
|
|
||||||
# make sure lock path and conf path exist
|
|
||||||
file { $conf_d:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
file { $lockpath:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
file { $cron_dir:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
file { $snapshot_root:
|
|
||||||
ensure => 'directory',
|
|
||||||
}
|
|
||||||
# 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 function checks $hosts for elements like:
|
|
||||||
# { foo => } and converts those to { foo => {} }
|
|
||||||
$hosts_clean = assert_empty_hash($hosts)
|
|
||||||
|
|
||||||
$hosts_clean.each |String $host, Hash $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 = $hash['backup']
|
|
||||||
$backup_defaults = pick($hash['backup_defaults'], $rsnapshot::params::config_backup_defaults)
|
|
||||||
$cmd_cp = pick($hash['cmd_cp'], $rsnapshot::params::config_cmd_cp)
|
|
||||||
$cmd_rm = pick($hash['cmd_rm'], $rsnapshot::params::config_cmd_rm)
|
|
||||||
$cmd_rsync = pick($hash['cmd_rsync'], $rsnapshot::params::config_cmd_rsync)
|
|
||||||
$cmd_ssh = pick($hash['cmd_ssh'], $rsnapshot::params::config_cmd_ssh)
|
|
||||||
$cmd_logger = pick($hash['cmd_logger'], $rsnapshot::params::config_cmd_logger)
|
|
||||||
$cmd_du = pick($hash['cmd_du'], $rsnapshot::params::config_cmd_du)
|
|
||||||
$cmd_rsnapshot_diff = pick_undef($hash['cmd_rsnapshot_diff'], $rsnapshot::params::config_cmd_rsnapshot_diff)
|
|
||||||
$cmd_preexec = pick_undef($hash['cmd_preexec'], $rsnapshot::params::config_cmd_preexec)
|
|
||||||
$cmd_postexec = pick_undef($hash['cmd_postexec'], $rsnapshot::params::config_cmd_postexec)
|
|
||||||
$use_lvm = pick_undef($hash['use_lvm'], $rsnapshot::params::config_use_lvm)
|
|
||||||
$linux_lvm_cmd_lvcreate = pick_undef($hash['linux_lvm_cmd_lvcreate'], $rsnapshot::params::config_linux_lvm_cmd_lvcreate)
|
|
||||||
$linux_lvm_cmd_lvremove = pick_undef($hash['linux_lvm_cmd_lvremove'], $rsnapshot::params::config_linux_lvm_cmd_lvremove)
|
|
||||||
$linux_lvm_cmd_mount = pick_undef($hash['linux_lvm_cmd_mount'], $rsnapshot::params::config_linux_lvm_cmd_mount)
|
|
||||||
$linux_lvm_cmd_umount = pick_undef($hash['linux_lvm_cmd_umount'], $rsnapshot::params::config_linux_lvm_cmd_umount)
|
|
||||||
$linux_lvm_snapshotsize = pick_undef($hash['linux_lvm_snapshotsize'], $rsnapshot::params::config_linux_lvm_snapshotsize)
|
|
||||||
$linux_lvm_snapshotname = pick_undef($hash['linux_lvm_snapshotname'], $rsnapshot::params::config_linux_lvm_snapshotname)
|
|
||||||
$linux_lvm_vgpath = pick_undef($hash['linux_lvm_vgpath'], $rsnapshot::params::config_linux_lvm_vgpath)
|
|
||||||
$linux_lvm_mountpath = pick_undef($hash['linux_lvm_mountpath'], $rsnapshot::params::config_linux_lvm_mountpath)
|
|
||||||
$no_create_root = pick_undef($hash['no_create_root'], $rsnapshot::params::config_no_create_root)
|
|
||||||
$logpath = pick($hash['logpath'], $rsnapshot::logpath, $rsnapshot::params::config_logpath)
|
|
||||||
$verbose = pick($hash['verbose'], $rsnapshot::params::config_verbose)
|
|
||||||
$loglevel = pick($hash['loglevel'], $rsnapshot::params::config_loglevel)
|
|
||||||
$stop_on_stale_lockfile = pick_undef($hash['stop_on_stale_lockfile'], $rsnapshot::params::config_stop_on_stale_lockfile)
|
|
||||||
$rsync_short_args = pick($hash['rsync_short_args'], $rsnapshot::params::config_rsync_short_args)
|
|
||||||
$rsync_long_args = pick_undef($hash['rsync_long_args'], $rsnapshot::params::config_rsync_long_args)
|
|
||||||
$ssh_args = pick_undef($hash['ssh_args'], $rsnapshot::params::config_ssh_args)
|
|
||||||
$du_args = pick_undef($hash['du_args'], $rsnapshot::params::config_du_args)
|
|
||||||
$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)
|
|
||||||
$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)
|
|
||||||
$use_lazy_deletes = pick_undef($hash['use_lazy_deletes'], $rsnapshot::params::config_use_lazy_deletes)
|
|
||||||
$rsync_numtries = pick_undef($hash['rsync_numtries'], $rsnapshot::params::config_rsync_numtries)
|
|
||||||
$backup_scripts = pick_undef($hash['backup_scripts'], $rsnapshot::params::config_backup_scripts)
|
|
||||||
|
|
||||||
$snapshot_dir = "${config_snapshot_root}/${host}"
|
|
||||||
$config = "${conf_d}/${host}.rsnapshot.conf"
|
|
||||||
$lockfile = "${lockpath}/${host}.pid"
|
|
||||||
$logfile = "${logpath}/${host}.log"
|
|
||||||
|
|
||||||
# fail if $backup_defaults is set to false and no $host[backup] defined
|
|
||||||
if ! $backup_defaults and ! $backup {
|
|
||||||
fail("==> Configuration error: backup_defaults is ${backup_defaults} and backup definitions for this host don't exist <==")
|
|
||||||
}
|
|
||||||
|
|
||||||
# merge the backup hashes to one if backup_default is set (defaults to true)
|
|
||||||
if $backup_defaults {
|
|
||||||
$backups = merge($backup, $default_backup_dirs)
|
|
||||||
} else {
|
|
||||||
$backups = $backup
|
|
||||||
}
|
|
||||||
|
|
||||||
# one of both interval or retain must be present
|
|
||||||
if ! ( $interval and $retain ) {
|
|
||||||
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
|
||||||
}
|
|
||||||
# rsnapshot wants numeric values
|
|
||||||
if $link_dest {
|
|
||||||
$link_dest_num = bool2num($link_dest)
|
|
||||||
}
|
|
||||||
if $sync_first {
|
|
||||||
$sync_first_num = bool2num($sync_first)
|
|
||||||
}
|
|
||||||
if $use_lazy_deletes {
|
|
||||||
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
|
||||||
}
|
|
||||||
|
|
||||||
file { $exclude_file:
|
|
||||||
ensure => 'file',
|
|
||||||
}
|
|
||||||
file { $config:
|
|
||||||
content => template('rsnapshot/rsnapshot.erb')
|
|
||||||
}
|
|
||||||
$cronfile = "${cron_dir}/${host}"
|
|
||||||
concat { "${cronfile}":
|
|
||||||
}
|
|
||||||
$backup_levels.each |String $level| {
|
|
||||||
if validate_hash($hash) {
|
|
||||||
# allow to globally override ranges, create random numbers for backup_levels daily, weekly, monthly
|
|
||||||
if has_key($host, 'cron'){
|
|
||||||
$c_min = pick($host['cron'][$level]['minute'], $rsnapshot::params::cron[$level]['minute'], '*')
|
|
||||||
$c_hour = pick($host['cron'][$level]['hour'], $rsnapshot::params::cron[$level]['hour'], '*')
|
|
||||||
$c_monthday = pick($host['cron'][$level]['monthday'], $rsnapshot::params::cron[$level]['monthday'], '*')
|
|
||||||
$c_month = pick($host['cron'][$level]['month'], $rsnapshot::params::cron[$level]['month'], '*')
|
|
||||||
$c_weekday = pick($host['cron'][$level]['weekday'], $rsnapshot::params::cron[$level]['weekday'], '*')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$c_min = $rsnapshot::params::cron[$level]['minute']
|
|
||||||
$c_hour = $rsnapshot::params::cron[$level]['hour']
|
|
||||||
$c_monthday = $rsnapshot::params::cron[$level]['monthday']
|
|
||||||
$c_month = $rsnapshot::params::cron[$level]['month']
|
|
||||||
$c_weekday = $rsnapshot::params::cron[$level]['weekday']
|
|
||||||
}
|
|
||||||
$minute = rand_from_array($c_min, "${host}.${level}")
|
|
||||||
$hour = rand_from_array($c_hour, "${host}.${level}")
|
|
||||||
$monthday = rand_from_array($c_monthday, "${host}.${level}")
|
|
||||||
$month = rand_from_array($c_month, "${host}.${level}")
|
|
||||||
$weekday = rand_from_array($c_weekday, "${host}.${level}")
|
|
||||||
concat::fragment { "${host}.${level}":
|
|
||||||
target => "${cronfile}",
|
|
||||||
content => template('rsnapshot/cron.erb'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
# this class sets up cron
|
|
||||||
# * todo
|
|
||||||
# let the user specify a range of hours and randomize cron creation in this range use rand for #args and return arg[rand]
|
|
||||||
|
|
||||||
class rsnapshot::cron {
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
# == Class: rsnapshot
|
|
||||||
#
|
|
||||||
# Manages rsnapshot.
|
|
||||||
#
|
|
||||||
# === Parameters
|
|
||||||
#
|
|
||||||
class rsnapshot (
|
|
||||||
$hosts = $rsnapshot::params::hosts,
|
|
||||||
$conf_d = $rsnapshot::params::conf_d,
|
|
||||||
$logpath = $rsnapshot::params::config_logpath,
|
|
||||||
$lockpath = $rsnapshot::params::config_lockpath,
|
|
||||||
$default_backup = $rsnapshot::params::config_default_backup,
|
|
||||||
$package_name = $rsnapshot::params::package_name,
|
|
||||||
$package_ensure = $rsnapshot::params::package_ensure,
|
|
||||||
) inherits rsnapshot::params {
|
|
||||||
if $hosts {
|
|
||||||
class { 'rsnapshot::install': }->
|
|
||||||
class { 'rsnapshot::config': }
|
|
||||||
contain 'rsnapshot::install'
|
|
||||||
contain 'rsnapshot::config'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
# == Class: rsnapshot::install
|
|
||||||
#
|
|
||||||
# Installs the rsnapshot package.
|
|
||||||
class rsnapshot::install inherits rsnapshot {
|
|
||||||
case $::operatingsystem {
|
|
||||||
/^CentOS$/: { include epel }
|
|
||||||
default: {}
|
|
||||||
}
|
|
||||||
package { $rsnapshot::package_name:
|
|
||||||
ensure => $rsnapshot::package_ensure,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
# == Class: rsnapshot
|
|
||||||
#
|
|
||||||
# default params
|
|
||||||
class rsnapshot::params {
|
|
||||||
$hosts = undef
|
|
||||||
$conf_d = '/etc/rsnapshot' # the place where the host specific configs are stored
|
|
||||||
$config_backup_user = 'root'
|
|
||||||
$package_name = 'rsnapshot'
|
|
||||||
$package_ensure = 'present'
|
|
||||||
$cron_dir = '/etc/cron.d'
|
|
||||||
$config_backup_levels = [ 'daily', 'weekly', ]
|
|
||||||
$config_backup_defaults = true
|
|
||||||
$config_version = '1.2'
|
|
||||||
$config_cmd_cp = '/bin/cp'
|
|
||||||
$config_cmd_rm = '/bin/rm'
|
|
||||||
$config_cmd_rsync = '/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_preexec = undef
|
|
||||||
$config_cmd_postexec = undef
|
|
||||||
$config_use_lvm = undef
|
|
||||||
$config_linux_lvm_cmd_lvcreate = undef # '/sbin/lvcreate'
|
|
||||||
$config_linux_lvm_cmd_lvremove = undef # '/sbin/lvremove'
|
|
||||||
$config_linux_lvm_cmd_mount = undef # '/sbin/mount'
|
|
||||||
$config_linux_lvm_cmd_umount = undef # '/sbin/umount'
|
|
||||||
$config_linux_lvm_snapshotsize = undef # '100M'
|
|
||||||
$config_linux_lvm_snapshotname = undef # 'rsnapshot'
|
|
||||||
$config_linux_lvm_vgpath = undef # '/dev'
|
|
||||||
$config_linux_lvm_mountpath = undef # '/mount/rsnapshot'
|
|
||||||
$config_logpath = '/var/log/rsnapshot'
|
|
||||||
$config_logfile = '/var/log/rsnapshot.log' # unused, we are logging to $logpath/$host.log
|
|
||||||
$config_lockpath = '/var/run/rsnapshot'
|
|
||||||
$config_snapshot_root = '/backup/'
|
|
||||||
$config_no_create_root = undef # bool, true or false
|
|
||||||
$config_verbose = '2'
|
|
||||||
$config_loglevel = '4'
|
|
||||||
$config_stop_on_stale_lockfile = undef # bool
|
|
||||||
$config_rsync_short_args = '-az'
|
|
||||||
$config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded
|
|
||||||
$config_ssh_args = undef
|
|
||||||
$config_du_args = undef
|
|
||||||
$config_one_fs = undef
|
|
||||||
$config_retain = { }
|
|
||||||
$config_interval = {
|
|
||||||
'daily' => '7',
|
|
||||||
'weekly' => '4',
|
|
||||||
'monthly' => '6',
|
|
||||||
}
|
|
||||||
$config_include = []
|
|
||||||
$config_exclude = []
|
|
||||||
$config_include_file = undef
|
|
||||||
$config_exclude_file = undef
|
|
||||||
$config_link_dest = false
|
|
||||||
$config_sync_first = false
|
|
||||||
$config_rsync_numtries = 1
|
|
||||||
$config_use_lazy_deletes = false
|
|
||||||
$config_default_backup = {
|
|
||||||
'/etc' => './',
|
|
||||||
'/home' => './',
|
|
||||||
}
|
|
||||||
$config_backup_scripts = {}
|
|
||||||
$cron = {
|
|
||||||
'hourly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '*', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
'daily' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
'weekly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '*',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '0..6',
|
|
||||||
},
|
|
||||||
'monthly' => {
|
|
||||||
'minute' => '0..59',
|
|
||||||
'hour' => '0..23', # you could also do: ['21..23','0..4','5'],
|
|
||||||
'monthday' => '0..28',
|
|
||||||
'month' => '*',
|
|
||||||
'weekday' => '*',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "loomsen-rsnapshot",
|
|
||||||
"version": "0.1.1",
|
|
||||||
"author": "loomsen",
|
|
||||||
"summary": "Configures rsnapshot.",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"source": "https://github.com/loomsen/puppet-rsnapshot",
|
|
||||||
"project_page": "https://github.com/loomsen/puppet-rsnapshot",
|
|
||||||
"issues_url": "https://github.com/loomsen/puppet-rsnapshot/issues",
|
|
||||||
"dependencies": [
|
|
||||||
{"name":"puppetlabs-stdlib"},
|
|
||||||
{"name":"stahnma-epel"}
|
|
||||||
],
|
|
||||||
"data_provider": null,
|
|
||||||
"tags": [
|
|
||||||
"rsnapshot",
|
|
||||||
"backup",
|
|
||||||
"rsync"
|
|
||||||
],
|
|
||||||
"requirements": [
|
|
||||||
{
|
|
||||||
"name": "pe",
|
|
||||||
"version_requirement": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "puppet",
|
|
||||||
"version_requirement": ">= 3.0.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"operatingsystem_support": [
|
|
||||||
{
|
|
||||||
"operatingsystem": "CentOS",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"5",
|
|
||||||
"6",
|
|
||||||
"7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Debian",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"6",
|
|
||||||
"7",
|
|
||||||
"8"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Ubuntu",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"12.04",
|
|
||||||
"10.04",
|
|
||||||
"14.04"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"operatingsystem": "Fedora",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"17",
|
|
||||||
"18",
|
|
||||||
"19",
|
|
||||||
"20",
|
|
||||||
"21",
|
|
||||||
"22",
|
|
||||||
"23",
|
|
||||||
"24"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1204-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-12.04-amd64
|
|
||||||
hypervisor : docker
|
|
||||||
image: ubuntu:12.04
|
|
||||||
# This stops the image from being deleted on completion, speeding up the process.
|
|
||||||
docker_preserve_image: true
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1204-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-12.04-amd64
|
|
||||||
hypervisor : vagrant
|
|
||||||
box : puppetlabs/ubuntu-12.04-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor : docker
|
|
||||||
image: ubuntu:14.04
|
|
||||||
# This stops the image from being deleted on completion, speeding up the process.
|
|
||||||
docker_preserve_image: true
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
default_apply_opts:
|
|
||||||
strict_variables:
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor : vagrant
|
|
||||||
box : puppetlabs/ubuntu-14.04-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
log_level: debug
|
|
@ -1,37 +0,0 @@
|
|||||||
require 'spec_helper'
|
|
||||||
describe 'rsnapshot' do
|
|
||||||
|
|
||||||
{'Ubuntu' => 'Debian', 'Debian' => 'Debian'}.each do |system, family|
|
|
||||||
context "when on system #{system} no lvm" do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when on system #{system} with lvm" do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:params) { {:use_lvm => true} }
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('/etc/rsnapshot.conf').with_content(/^linux_lvm_((\w|_)+)\t(.*)$/)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
--format
|
|
||||||
s
|
|
||||||
--colour
|
|
||||||
--loadby
|
|
||||||
mtime
|
|
||||||
--backtrace
|
|
@ -1,29 +0,0 @@
|
|||||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
|
||||||
|
|
||||||
RSpec.configure do |c|
|
|
||||||
c.include PuppetlabsSpec::Files
|
|
||||||
|
|
||||||
c.before :each do
|
|
||||||
# Ensure that we don't accidentally cache facts and environment
|
|
||||||
# between test cases.
|
|
||||||
Facter::Util::Loader.any_instance.stubs(:load_all)
|
|
||||||
Facter.clear
|
|
||||||
Facter.clear_messages
|
|
||||||
|
|
||||||
# Store any environment variables away to be restored later
|
|
||||||
@old_env = {}
|
|
||||||
ENV.each_key {|k| @old_env[k] = ENV[k]}
|
|
||||||
|
|
||||||
if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
|
|
||||||
Puppet.settings[:strict_variables]=true
|
|
||||||
end
|
|
||||||
if ENV['PARSER']
|
|
||||||
Puppet.settings[:parser]=ENV['PARSER']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
c.after :each do
|
|
||||||
PuppetlabsSpec::Files.cleanup
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
<%= @minute %> <%= @hour %> <%= @month %> <%= @monthday %> <%= @weekday %> root /usr/bin/rsnapshot -c <%= @config %> <%= @level %>
|
|
@ -1,144 +0,0 @@
|
|||||||
# This file is being managed by puppet
|
|
||||||
# Module 'rsnaphost'
|
|
||||||
|
|
||||||
config_version <%= @config_version %>
|
|
||||||
snapshot_root <%= @snapshot_root %>
|
|
||||||
<% if @no_create_root != '' -%>
|
|
||||||
no_create_root <%= @no_create_root %>
|
|
||||||
<% end -%>
|
|
||||||
cmd_rsync <%= @cmd_rsync %>
|
|
||||||
<% if @cmd_cp != '' -%>
|
|
||||||
cmd_cp <%= @cmd_cp %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_rm != '' -%>
|
|
||||||
cmd_rm <%= @cmd_rm %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_ssh != '' -%>
|
|
||||||
cmd_ssh <%= @cmd_ssh %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_logger != '' -%>
|
|
||||||
cmd_logger <%= @cmd_logger %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_du != '' -%>
|
|
||||||
cmd_du <%= @cmd_du %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_rsnapshot_diff != '' -%>
|
|
||||||
cmd_rsnapshot_diff <%= @cmd_rsnapshot_diff %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_preexec != '' -%>
|
|
||||||
cmd_preexec <%= @cmd_preexec %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @cmd_postexec != '' -%>
|
|
||||||
cmd_postexec <%= @cmd_postexec %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lvm != '' -%>
|
|
||||||
<% if @linux_lvm_cmd_lvcreate -%>
|
|
||||||
linux_lvm_cmd_lvcreate <%= @linux_lvm_cmd_lvcreate %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_lvremove != '' -%>
|
|
||||||
linux_lvm_cmd_lvremove <%= @linux_lvm_cmd_lvremove %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_mount != '' -%>
|
|
||||||
linux_lvm_cmd_mount <%= @linux_lvm_cmd_mount %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_cmd_umount != '' -%>
|
|
||||||
linux_lvm_cmd_umount <%= @linux_lvm_cmd_umount %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
#########################################
|
|
||||||
# BACKUP INTERVALS #
|
|
||||||
# Must be unique and in ascending order #
|
|
||||||
# i.e. hourly, daily, weekly, etc. #
|
|
||||||
#########################################
|
|
||||||
<%if @interval != '' -%>
|
|
||||||
<% @interval.each_pair do |name, time| -%>
|
|
||||||
interval <%= name %> <%= time %>
|
|
||||||
<% end -%>
|
|
||||||
<% else %>
|
|
||||||
<% @retain.each_pair do |name, time| -%>
|
|
||||||
retain <%= name %> <%= time %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
verbose <%= @verbose %>
|
|
||||||
loglevel <%= @loglevel %>
|
|
||||||
<% if @logfile != '' -%>
|
|
||||||
logfile <%= @logfile %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @lockfile != '' -%>
|
|
||||||
lockfile <%= @lockfile %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @stop_on_stale_lockfile != '' -%>
|
|
||||||
stop_on_stale_lockfile <%= @stop_on_stale_lockfile %>
|
|
||||||
<%end-%>
|
|
||||||
<% if @rsync_short_args != '' -%>
|
|
||||||
rsync_short_args <%= @rsync_short_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @rsync_long_args != '' -%>
|
|
||||||
rsync_long_args <%= @rsync_long_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @ssh_args != '' -%>
|
|
||||||
ssh_args <%= @ssh_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @du_args != '' -%>
|
|
||||||
du_args <%= @du_args %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @one_fs != '' %>
|
|
||||||
one_fs <%= @one_fs_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @include != '' %>
|
|
||||||
<% @include.each do |pattern| -%>
|
|
||||||
include <%= pattern %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
<% if @exclude != '' %>
|
|
||||||
<% @exclude.each do |pattern| -%>
|
|
||||||
exclude <%= pattern %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
<% if @include_file != '' -%>
|
|
||||||
include_file <%= @include_file %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @exclude_file != '' -%>
|
|
||||||
exclude_file <%= @exclude_file %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @link_dest != '' -%>
|
|
||||||
link_dest <%= @link_dest_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @sync_first != '' -%>
|
|
||||||
sync_first <%= @sync_first_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lazy_deletes != '' -%>
|
|
||||||
use_lazy_deletes <%= @use_lazy_deletes_num %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @rsync_numtries != '' -%>
|
|
||||||
rsync_numtries <%= @rsync_numtries %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @use_lvm != '' -%>
|
|
||||||
<% if @linux_lvm_snapshotsize -%>
|
|
||||||
linux_lvm_snapshotsize <%= @linux_lvm_snapshotsize %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_snapshotname != '' -%>
|
|
||||||
linux_lvm_snapshotname <%= @linux_lvm_snapshotname %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_vgpath != '' -%>
|
|
||||||
linux_lvm_vgpath <%= @linux_lvm_vgpath %>
|
|
||||||
<% end -%>
|
|
||||||
<% if @linux_lvm_mountpath != '' -%>
|
|
||||||
linux_lvm_mountpath <%= @linux_lvm_mountpath %>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
<% @backups.each_pair do |source, dest| -%>
|
|
||||||
<% if @host == 'localhost' -%>
|
|
||||||
backup <%= source %> <%=dest%>
|
|
||||||
<% elsif @backup_user != '' -%>
|
|
||||||
backup <%= @backup_user %>@<%=@host%>:<%= source %> <%=dest%>
|
|
||||||
<% else -%>
|
|
||||||
backup <%=@host%>:<%= source %> <%=dest%>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
<% if @backup_scripts != '' -%>
|
|
||||||
<% @backup_scripts.each_pair do |source, dest| -%>
|
|
||||||
backup_script <%= source %> <%= dest %>
|
|
||||||
<% end -%>
|
|
||||||
<%end-%>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
# The baseline for module testing used by Puppet Labs is that each manifest
|
|
||||||
# should have a corresponding test manifest that declares that class or defined
|
|
||||||
# type.
|
|
||||||
#
|
|
||||||
# Tests are then run by using puppet apply --noop (to check for compilation
|
|
||||||
# errors and view a log of events) or by fully applying the test in a virtual
|
|
||||||
# environment (to compare the resulting system state to the desired state).
|
|
||||||
#
|
|
||||||
# Learn more about module testing here:
|
|
||||||
# http://docs.puppetlabs.com/guides/tests_smoke.html
|
|
||||||
#
|
|
||||||
include rsnapshot
|
|
Loading…
Reference in New Issue
Block a user