mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2025-04-10 16:24:21 +00:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
512130b0d8 | |||
f3cd595a8f | |||
|
03c31b78c2 | ||
|
679c742fd3 | ||
|
9327c68d59 | ||
|
b72f1dfb36 | ||
|
4820ededfa | ||
|
c7e02c53dd | ||
|
43cd819749 | ||
|
ab20bea159 | ||
|
8aba7d0782 | ||
|
a774e8b360 | ||
|
02b61e2180 | ||
|
063df85094 | ||
|
765ed614b7 | ||
|
94b890df6d | ||
|
a2dfd903c3 | ||
|
3ae826a0e0 | ||
|
efa6ef8808 | ||
|
e1f5fa7ebe | ||
|
2590264764 | ||
|
165bcd0766 | ||
|
434afe708b | ||
|
395efceea9 | ||
|
8f25dab414 | ||
|
4d810759ac | ||
|
090cf17370 | ||
|
1a68a16c79 | ||
|
4124d18885 | ||
|
8fb1b403e0 | ||
|
e681cc959e | ||
|
9d42f4d0cd | ||
|
e999869e8c | ||
|
3089c49a66 | ||
|
92a466d90a | ||
|
d2cf15621b | ||
|
450474165f | ||
|
33f7031f2c | ||
|
3821db2c4f |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
pkg/
|
pkg/
|
||||||
vendor/
|
vendor/
|
||||||
|
log/
|
13
.travis.yml
13
.travis.yml
@ -2,13 +2,20 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: ruby
|
language: ruby
|
||||||
cache: bundler
|
cache: bundler
|
||||||
bundler_args: --without system_tests
|
|
||||||
script: "bundle exec rake validate && bundle exec rake spec SPEC_OPTS='--format documentation'"
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
rvm: 2.1
|
- rvm: 2.1
|
||||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake validate"
|
||||||
|
- rvm: 2.1
|
||||||
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||||
|
- rvm: 2.1
|
||||||
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake beaker"
|
||||||
|
services: docker
|
||||||
|
sudo: required
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
|
6
Gemfile
6
Gemfile
@ -6,3 +6,9 @@ gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
|||||||
gem 'puppet-lint', '>= 1.0.0'
|
gem 'puppet-lint', '>= 1.0.0'
|
||||||
gem 'facter', '>= 1.7.0'
|
gem 'facter', '>= 1.7.0'
|
||||||
gem 'metadata-json-lint'
|
gem 'metadata-json-lint'
|
||||||
|
|
||||||
|
group :acceptance do
|
||||||
|
gem 'beaker-rspec', '5.6.0'
|
||||||
|
gem 'serverspec', require: false
|
||||||
|
gem 'specinfra', require: false
|
||||||
|
end
|
||||||
|
117
README.md
117
README.md
@ -42,6 +42,7 @@ This module is best used with an ENC like hiera. It will make your config much e
|
|||||||
* This module will install the rsnapshot package on your system
|
* This module will install the rsnapshot package on your system
|
||||||
* This module will manage the rsnapshot config on your system
|
* This module will manage the rsnapshot config on your system
|
||||||
* This module will manage cron entries for your configured nodes
|
* This module will manage cron entries for your configured nodes
|
||||||
|
* This module will manage the cron service on your system
|
||||||
|
|
||||||
### Setup Requirements
|
### Setup Requirements
|
||||||
|
|
||||||
@ -150,11 +151,13 @@ rsnapshot::hosts:
|
|||||||
The defaults are pretty reasonable, I hope. However, you may override pretty much anything. Available parameters are discussed below.
|
The defaults are pretty reasonable, I hope. However, you may override pretty much anything. Available parameters are discussed below.
|
||||||
|
|
||||||
#### Specials
|
#### 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.
|
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:
|
You may specify time ranges as follows:
|
||||||
* default cron syntax
|
* default cron syntax
|
||||||
* 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.
|
* an array with allowed values
|
||||||
in hiera this would look like: (Explanation see below)
|
- 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
|
```yaml
|
||||||
rsnapshot::hosts:
|
rsnapshot::hosts:
|
||||||
@ -326,7 +329,7 @@ Default is:
|
|||||||
monthly => {
|
monthly => {
|
||||||
minute => '0..59',
|
minute => '0..59',
|
||||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||||
monthday => '0..28',
|
monthday => '1..28',
|
||||||
month => '*',
|
month => '*',
|
||||||
weekday => '*',
|
weekday => '*',
|
||||||
},
|
},
|
||||||
@ -336,6 +339,15 @@ Default is:
|
|||||||
#### `$cron_dir`
|
#### `$cron_dir`
|
||||||
Directory to drop the cron files to. Crons will be created per host.
|
Directory to drop the cron files to. Crons will be created per host.
|
||||||
(Default: /etc/cron.d)
|
(Default: /etc/cron.d)
|
||||||
|
|
||||||
|
#### `$cronfile_prefix_use`
|
||||||
|
Bool. Set this to true if you want your cronfiles to have a prefix.
|
||||||
|
(Default: false)
|
||||||
|
|
||||||
|
#### `$cronfile_prefix`
|
||||||
|
Optional prefix to add to the cronfiles name. Your files will be named: prefix_hostname
|
||||||
|
(Default: 'rsnapshot_' only if you set $cronfile_prefix_use = true)
|
||||||
|
|
||||||
#### `$default_backup`
|
#### `$default_backup`
|
||||||
The default backup directories. This will apply to all hosts unless you set [backup_defaults](#backup_defaults) = false
|
The default backup directories. This will apply to all hosts unless you set [backup_defaults](#backup_defaults) = false
|
||||||
Default is:
|
Default is:
|
||||||
@ -346,15 +358,11 @@ Default is:
|
|||||||
'/home' => './',
|
'/home' => './',
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
#### `$cronfile_prefix_use`
|
|
||||||
Bool. Set this to true if you want your cronfiles to have a prefix.
|
|
||||||
(Default: false)
|
|
||||||
#### `$cronfile_prefix`
|
|
||||||
Optional prefix to add to the cronfiles name. Your files will be named: prefix_hostname
|
|
||||||
(Default: 'rsnapshot_' only if you set $cronfile_prefix_use = true)
|
|
||||||
#### `$hosts`
|
#### `$hosts`
|
||||||
Hash containing the hosts to be backed up and optional overrides per host
|
Hash containing the hosts to be backed up and optional overrides per host
|
||||||
(Default: undef (do nothing when no host given))
|
(Default: undef (do nothing when no host given))
|
||||||
|
|
||||||
#### `$interval`
|
#### `$interval`
|
||||||
How many backups of each level to keep.
|
How many backups of each level to keep.
|
||||||
Default is:
|
Default is:
|
||||||
@ -369,8 +377,10 @@ Default is:
|
|||||||
|
|
||||||
#### `$package_ensure`
|
#### `$package_ensure`
|
||||||
(Default: present)
|
(Default: present)
|
||||||
|
|
||||||
#### `$package_name`
|
#### `$package_name`
|
||||||
(Default: rsnapshot)
|
(Default: rsnapshot)
|
||||||
|
|
||||||
#### `$snapshot_root`
|
#### `$snapshot_root`
|
||||||
global. the directory holding your backups.
|
global. the directory holding your backups.
|
||||||
(Default: /backup)
|
(Default: /backup)
|
||||||
@ -637,9 +647,25 @@ Default is: undef
|
|||||||
#### `$cmd_postexec`
|
#### `$cmd_postexec`
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
#### `$use_lvm`
|
#### `$du_args`
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
|
#### `$exclude`
|
||||||
|
Default is: []
|
||||||
|
|
||||||
|
#### `$exclude_file`
|
||||||
|
Other than this might suggest, the default behavior is to create an exclude file per host.
|
||||||
|
Default is: undef
|
||||||
|
|
||||||
|
#### `$include`
|
||||||
|
Default is: []
|
||||||
|
|
||||||
|
#### `$include_file`
|
||||||
|
Default is: undef
|
||||||
|
|
||||||
|
#### `$link_dest`
|
||||||
|
Default is: false
|
||||||
|
|
||||||
#### `$linux_lvm_cmd_lvcreate`
|
#### `$linux_lvm_cmd_lvcreate`
|
||||||
Default is: undef # '/sbin/lvcreate'
|
Default is: undef # '/sbin/lvcreate'
|
||||||
|
|
||||||
@ -665,6 +691,9 @@ Default is: undef
|
|||||||
#### `$linux_lvm_mountpath`
|
#### `$linux_lvm_mountpath`
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
|
#### `$lockpath`
|
||||||
|
Default is: '/var/run/rsnapshot'
|
||||||
|
|
||||||
#### `$logpath`
|
#### `$logpath`
|
||||||
Default is: '/var/log/rsnapshot'
|
Default is: '/var/log/rsnapshot'
|
||||||
|
|
||||||
@ -672,73 +701,55 @@ Default is: '/var/log/rsnapshot'
|
|||||||
unused, we are logging to $logpath/$host.log
|
unused, we are logging to $logpath/$host.log
|
||||||
Default is: '/var/log/rsnapshot.log'
|
Default is: '/var/log/rsnapshot.log'
|
||||||
|
|
||||||
#### `$lockpath`
|
|
||||||
Default is: '/var/run/rsnapshot'
|
|
||||||
|
|
||||||
#### `$snapshot_root`
|
|
||||||
Default is: '/backup/'
|
|
||||||
|
|
||||||
#### `$no_create_root`
|
|
||||||
Boolean: true or false
|
|
||||||
Default is: undef
|
|
||||||
|
|
||||||
#### `$verbose`
|
|
||||||
Default is: '2'
|
|
||||||
|
|
||||||
#### `$loglevel`
|
#### `$loglevel`
|
||||||
Default is: '4'
|
Default is: '4'
|
||||||
|
|
||||||
#### `$stop_on_stale_lockfile`
|
#### `$manage_cron`
|
||||||
|
Should this module manage the cron service?
|
||||||
|
Default is: true
|
||||||
|
|
||||||
|
#### `$no_create_root`
|
||||||
Boolean: true or false
|
Boolean: true or false
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
#### `$rsync_short_args`
|
|
||||||
Default is: '-az'
|
|
||||||
|
|
||||||
#### `$rsync_long_args`
|
|
||||||
rsync defaults are: --delete --numeric-ids --relative --delete-excluded
|
|
||||||
Default is: undef
|
|
||||||
|
|
||||||
#### `$ssh_args`
|
|
||||||
Default is: undef
|
|
||||||
|
|
||||||
#### `$du_args`
|
|
||||||
Default is: undef
|
|
||||||
|
|
||||||
#### `$one_fs`
|
#### `$one_fs`
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
#### `$retain`
|
#### `$retain`
|
||||||
Default is: { }
|
Default is: { }
|
||||||
|
|
||||||
#### `$include`
|
#### `$rsync_short_args`
|
||||||
Default is: []
|
Default is: '-az'
|
||||||
|
|
||||||
#### `$exclude`
|
|
||||||
Default is: []
|
|
||||||
|
|
||||||
#### `$include_file`
|
|
||||||
|
|
||||||
|
#### `$rsync_long_args`
|
||||||
|
rsync defaults are: --delete --numeric-ids --relative --delete-excluded
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
#### `$exclude_file`
|
#### `$rsync_numtries`
|
||||||
Other than this might suggest, the default behavior is to create an exclude file per host.
|
Default is: 1
|
||||||
|
|
||||||
|
#### `$snapshot_root`
|
||||||
|
Default is: '/backup/'
|
||||||
|
|
||||||
|
#### `$ssh_args`
|
||||||
Default is: undef
|
Default is: undef
|
||||||
|
|
||||||
#### `$link_dest`
|
#### `$stop_on_stale_lockfile`
|
||||||
Default is: false
|
Boolean: true or false
|
||||||
|
Default is: undef
|
||||||
|
|
||||||
#### `$sync_first`
|
#### `$sync_first`
|
||||||
Default is: false
|
Default is: false
|
||||||
|
|
||||||
#### `$rsync_numtries`
|
#### `$use_lvm`
|
||||||
|
Default is: undef
|
||||||
Default is: 1
|
|
||||||
|
|
||||||
#### `$use_lazy_deletes`
|
#### `$use_lazy_deletes`
|
||||||
Default is: false
|
Default is: false
|
||||||
|
|
||||||
|
#### `$verbose`
|
||||||
|
Default is: '2'
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
Currently, this module support CentOS, Fedora, Ubuntu and Debian.
|
Currently, this module support CentOS, Fedora, Ubuntu and Debian.
|
||||||
|
|
||||||
@ -750,5 +761,5 @@ want it off the face of the planet, feel free to get in touch with me.
|
|||||||
Norbert Varzariu (loomsen)
|
Norbert Varzariu (loomsen)
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
Please see the [list of contributors.](https://github.com/loomsen/puppet-bloonix_agent/graphs/contributors)
|
Please see the [list of contributors.](https://github.com/loomsen/puppet-rsnapshot/graphs/contributors)
|
||||||
A big thank you to Hendrik Horeis <hendrik.horeis@gmail.com> for all his input and testing of this module.
|
A big thank you to Hendrik Horeis <hendrik.horeis@gmail.com> for all his input and testing of this module.
|
||||||
|
@ -12,8 +12,8 @@ class rsnapshot::config (
|
|||||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d, '/etc/rsnapshot')
|
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d, '/etc/rsnapshot')
|
||||||
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::snapshot_root, '/backup')
|
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::snapshot_root, '/backup')
|
||||||
$logpath = pick($rsnapshot::logpath, $rsnapshot::params::config_logpath)
|
$logpath = pick($rsnapshot::logpath, $rsnapshot::params::config_logpath)
|
||||||
$cronfile_prefix_use = pick($rsnapshot::cronfile_prefix_use, $rsnapshot::params::cronfile_prefix_use, false)
|
$cronfile_prefix_use = pick($rsnapshot::cronfile_prefix_use, $rsnapshot::params::config_cronfile_prefix_use, false)
|
||||||
$cronfile_prefix = pick($rsnapshot::cronfile_prefix, $rsnapshot::params::cronfile_prefix, '')
|
$cronfile_prefix = pick($rsnapshot::cronfile_prefix, $rsnapshot::params::config_cronfile_prefix, '')
|
||||||
# make sure lock path and conf path exist
|
# make sure lock path and conf path exist
|
||||||
file { $conf_d:
|
file { $conf_d:
|
||||||
ensure => 'directory',
|
ensure => 'directory',
|
||||||
@ -82,7 +82,7 @@ class rsnapshot::config (
|
|||||||
$rsync_numtries = pick_undef($hash['rsync_numtries'], $rsnapshot::params::config_rsync_numtries)
|
$rsync_numtries = pick_undef($hash['rsync_numtries'], $rsnapshot::params::config_rsync_numtries)
|
||||||
#$backup_scripts = pick_undef($hash['backup_scripts'], $rsnapshot::params::config_backup_scripts)
|
#$backup_scripts = pick_undef($hash['backup_scripts'], $rsnapshot::params::config_backup_scripts)
|
||||||
|
|
||||||
$snapshot_dir = "${config_snapshot_root}/${host}"
|
$snapshot_dir = "${snapshot_root}/${host}"
|
||||||
$config = "${conf_d}/${host}.rsnapshot.conf"
|
$config = "${conf_d}/${host}.rsnapshot.conf"
|
||||||
$lockfile = "${lockpath}/${host}.pid"
|
$lockfile = "${lockpath}/${host}.pid"
|
||||||
$logfile = "${logpath}/${host}.log"
|
$logfile = "${logpath}/${host}.log"
|
||||||
@ -103,6 +103,7 @@ class rsnapshot::config (
|
|||||||
if ! ( $interval and $retain ) {
|
if ! ( $interval and $retain ) {
|
||||||
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
# rsnapshot wants numeric values
|
# rsnapshot wants numeric values
|
||||||
if $link_dest {
|
if $link_dest {
|
||||||
$link_dest_num = bool2num($link_dest)
|
$link_dest_num = bool2num($link_dest)
|
||||||
@ -113,6 +114,9 @@ class rsnapshot::config (
|
|||||||
if $use_lazy_deletes {
|
if $use_lazy_deletes {
|
||||||
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
||||||
}
|
}
|
||||||
|
if $one_fs {
|
||||||
|
$one_fs_num = bool2num($one_fs)
|
||||||
|
}
|
||||||
|
|
||||||
$real_include = $rsnapshot::include + $include
|
$real_include = $rsnapshot::include + $include
|
||||||
unless empty($real_include) {
|
unless empty($real_include) {
|
||||||
|
@ -18,7 +18,9 @@ class rsnapshot (
|
|||||||
$exclude = $rsnapshot::params::config_exclude,
|
$exclude = $rsnapshot::params::config_exclude,
|
||||||
$snapshot_root = $rsnapshot::params::config_snapshot_root,
|
$snapshot_root = $rsnapshot::params::config_snapshot_root,
|
||||||
$backup_levels = $rsnapshot::params::config_backup_levels,
|
$backup_levels = $rsnapshot::params::config_backup_levels,
|
||||||
|
$backup_user = $rsnapshot::params::config_backup_user,
|
||||||
$cron_service_name = $rsnapshot::params::cron_service_name,
|
$cron_service_name = $rsnapshot::params::cron_service_name,
|
||||||
|
$manage_cron = $rsnapshot::params::manage_cron,
|
||||||
$cronfile_prefix = $rsnapshot::params::config_cronfile_prefix,
|
$cronfile_prefix = $rsnapshot::params::config_cronfile_prefix,
|
||||||
$cronfile_prefix_use = $rsnapshot::params::config_cronfile_prefix_use,
|
$cronfile_prefix_use = $rsnapshot::params::config_cronfile_prefix_use,
|
||||||
$check_mk_job = $rsnapshot::params::config_check_mk_job,
|
$check_mk_job = $rsnapshot::params::config_check_mk_job,
|
||||||
|
@ -10,5 +10,18 @@ class rsnapshot::install {
|
|||||||
ensure => $rsnapshot::package_ensure,
|
ensure => $rsnapshot::package_ensure,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ensure run directory exists (systemd clears /var/run, so rsnapshot can't create PID files after reboot - issue#12)
|
||||||
|
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||||
|
$tmpfiles_d = '/etc/tmpfiles.d'
|
||||||
|
|
||||||
|
file { "${tmpfiles_d}":
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { "${tmpfiles_d}/rsnapshot.conf":
|
||||||
|
ensure => present,
|
||||||
|
content => "D ${lockpath} 0755 root root -",
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ class rsnapshot::params {
|
|||||||
'Debian' => 'cron',
|
'Debian' => 'cron',
|
||||||
default => '',
|
default => '',
|
||||||
}
|
}
|
||||||
|
$manage_cron = true
|
||||||
$cron_dir = '/etc/cron.d'
|
$cron_dir = '/etc/cron.d'
|
||||||
$config_backup_levels = [ 'daily', 'weekly', 'monthly' ]
|
$config_backup_levels = [ 'daily', 'weekly', 'monthly' ]
|
||||||
$config_backup_defaults = true
|
$config_backup_defaults = true
|
||||||
@ -95,7 +96,7 @@ class rsnapshot::params {
|
|||||||
monthly => {
|
monthly => {
|
||||||
minute => '0..59',
|
minute => '0..59',
|
||||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||||
monthday => '0..28',
|
monthday => '1..28',
|
||||||
month => '*',
|
month => '*',
|
||||||
weekday => '*',
|
weekday => '*',
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# == Class: rsnapshot::service
|
# == Class: rsnapshot::service
|
||||||
#
|
#
|
||||||
# Reloads cron
|
# Reloads cron
|
||||||
class rsnapshot::service {
|
class rsnapshot::service (
|
||||||
service { $rsnapshot::cron_service_name:
|
$manage_cron = $rsnapshot::manage_cron
|
||||||
ensure => running,
|
) {
|
||||||
|
|
||||||
|
if $manage_cron {
|
||||||
|
service { $rsnapshot::cron_service_name:
|
||||||
|
ensure => running,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "loomsen-rsnapshot",
|
"name": "loomsen-rsnapshot",
|
||||||
"version": "1.1.1",
|
"version": "1.2.5",
|
||||||
"author": "loomsen",
|
"author": "loomsen",
|
||||||
"summary": "Configures rsnapshot.",
|
"summary": "Configures rsnapshot.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@ -28,11 +28,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"operatingsystem": "Ubuntu",
|
"operatingsystem": "Ubuntu",
|
||||||
"operatingsystemrelease": [ "12.04", "10.04", "14.04" ]
|
"operatingsystemrelease": [ "12.04", "12.10", "13.04", "13.10", "14.04", "14.10", "15.04", "15.10", "16.04", "16.10", "17.04" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"operatingsystem": "Fedora",
|
"operatingsystem": "Fedora",
|
||||||
"operatingsystemrelease": [ "17", "18", "19", "20", "21", "22", "23", "24" ]
|
"operatingsystemrelease": [ "17", "18", "19", "20", "21", "22", "23", "24", "25" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
63
spec/acceptance/default_spec.rb
Normal file
63
spec/acceptance/default_spec.rb
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
|
describe 'rsnapshot' do
|
||||||
|
context 'with defaults' do
|
||||||
|
it 'run idempotently' do
|
||||||
|
pp = <<-EOS
|
||||||
|
class { 'rsnapshot':
|
||||||
|
hosts => {
|
||||||
|
'localhost' => {},
|
||||||
|
'example.com' => {
|
||||||
|
backup_defaults => false,
|
||||||
|
backup => {
|
||||||
|
'/var/' => './'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
|
||||||
|
apply_manifest(pp, catch_failures: true)
|
||||||
|
apply_manifest(pp, catch_changes: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'packages installed' do
|
||||||
|
describe package('rsnapshot') do
|
||||||
|
it { is_expected.to be_installed }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'files provisioned' do
|
||||||
|
describe file('/etc/tmpfiles.d') do
|
||||||
|
it { should be_directory }
|
||||||
|
end
|
||||||
|
describe file('/etc/tmpfiles.d/rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'D /var/run/rsnapshot 0755 root root -' }
|
||||||
|
end
|
||||||
|
describe file('/var/run/rsnapshot') do
|
||||||
|
it { should be_directory }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/example.com.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup\troot@example.com:/var/\t./' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'localhost' }
|
||||||
|
its(:content) { is_expected.to match 'example.com' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup' }
|
||||||
|
end
|
||||||
|
describe file('/etc/cron.d/example_com') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'example.com' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
spec/acceptance/nodesets/default.yml
Normal file
15
spec/acceptance/nodesets/default.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
HOSTS:
|
||||||
|
debian-8-x64:
|
||||||
|
platform: debian-8-amd64
|
||||||
|
hypervisor: docker
|
||||||
|
image: debian:8
|
||||||
|
docker_container_name: puppet_rsnapshot
|
||||||
|
docker_preserve_image: true
|
||||||
|
docker_cmd: '["/sbin/init"]'
|
||||||
|
docker_image_commands:
|
||||||
|
- 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list'
|
||||||
|
- 'apt-get update && apt-get install -y cron locales-all net-tools wget'
|
||||||
|
- 'rm -f /usr/sbin/policy-rc.d'
|
||||||
|
CONFIG:
|
||||||
|
trace_limit: 200
|
||||||
|
masterless: true
|
26
spec/spec_helper_acceptance.rb
Normal file
26
spec/spec_helper_acceptance.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require 'puppet'
|
||||||
|
require 'beaker-rspec'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
install_puppet_agent_on hosts, {}
|
||||||
|
|
||||||
|
RSpec.configure do |c|
|
||||||
|
# Module root and settings
|
||||||
|
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
module_name = module_root.split('/').last.sub('-', '_').split('_').last()
|
||||||
|
|
||||||
|
c.formatter = :documentation
|
||||||
|
c.max_displayed_failure_line_count = 5
|
||||||
|
|
||||||
|
c.before :suite do
|
||||||
|
puts 'Install module'
|
||||||
|
puppet_module_install(source: module_root, module_name: module_name)
|
||||||
|
|
||||||
|
hosts.each do |host|
|
||||||
|
puts 'Install fixtures'
|
||||||
|
on host, puppet('module','install','stahnma/epel')
|
||||||
|
on host, puppet('module','install','puppetlabs/stdlib')
|
||||||
|
on host, puppet('module','install','puppetlabs/concat')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user