1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-09-19 17:10:34 +00:00

fix README.md

This commit is contained in:
Norbert Varzariu 2015-12-21 14:50:17 +01:00
parent 25ae6a3af7
commit 3e7834c2ac
3 changed files with 30 additions and 8 deletions

View File

@ -205,6 +205,7 @@ 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,
@ -216,6 +217,26 @@ cron =>{
}
{...}
}
```
####`$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
```
### rsnapshot configuration variables
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
####`$cmd_cp`
@ -239,7 +260,6 @@ Please read up on the following in the [rsnapshot manpage](http://linux.die.net/
####`$logpath`
####`$logfile`
####`$lockpath`
####`$snapshot_root`
####`$no_create_root`
####`$verbose`
####`$loglevel`

View File

@ -9,6 +9,7 @@ class rsnapshot::config (
$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',
@ -19,6 +20,9 @@ class rsnapshot::config (
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:
@ -26,7 +30,6 @@ class rsnapshot::config (
$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')
@ -105,13 +108,12 @@ class rsnapshot::config (
}
file { $exclude_file:
ensure => file,
ensure => 'file',
}
file { $config:
content => template('rsnapshot/rsnapshot.erb')
}
$cronfile = "/tmp/rsnapshot.d/cron/${host}"
$cronfile = "${cron_dir}/${host}"
concat { "${cronfile}":
}
$backup_levels.each |String $level| {

View File

@ -3,11 +3,11 @@
# 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'
$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 = '/tmp/rsnapshot.d/cron'
$cron_dir = '/etc/cron.d'
$config_backup_levels = [ 'daily', 'weekly', ]
$config_backup_defaults = true
$config_version = '1.2'