1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-12-16 09:40:35 +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` ####`$cron`
Hash. Set time ranges for different backup levels. Hash. Set time ranges for different backup levels.
Hash is of the form: Hash is of the form:
```puppet
cron =>{ cron =>{
daily => { daily => {
minute => param, 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 ### rsnapshot configuration variables
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot) Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
####`$cmd_cp` ####`$cmd_cp`
@ -239,7 +260,6 @@ Please read up on the following in the [rsnapshot manpage](http://linux.die.net/
####`$logpath` ####`$logpath`
####`$logfile` ####`$logfile`
####`$lockpath` ####`$lockpath`
####`$snapshot_root`
####`$no_create_root` ####`$no_create_root`
####`$verbose` ####`$verbose`
####`$loglevel` ####`$loglevel`

View File

@ -9,6 +9,7 @@ class rsnapshot::config (
$config_version = $rsnapshot::params::config_version $config_version = $rsnapshot::params::config_version
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath) $lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath)
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d) $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 # make sure lock path and conf path exist
file { $conf_d: file { $conf_d:
ensure => 'directory', ensure => 'directory',
@ -19,6 +20,9 @@ class rsnapshot::config (
file { $cron_dir: file { $cron_dir:
ensure => 'directory', ensure => 'directory',
} }
file { $snapshot_root:
ensure => 'directory',
}
# custom function, if only a hostname is given as a param, this is an empty hash # 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 next loop would break as puppet does not allow to reassign variables
# the function checks $hosts for elements like: # the function checks $hosts for elements like:
@ -26,7 +30,6 @@ class rsnapshot::config (
$hosts_clean = assert_empty_hash($hosts) $hosts_clean = assert_empty_hash($hosts)
$hosts_clean.each |String $host, Hash $hash | { $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) $backup_user = pick($hash['backup_user'], $rsnapshot::params::config_backup_user)
$default_backup_dirs = pick($rsnapshot::default_backup, $rsnapshot::params::config_default_backup) $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_levels = pick($hash['backup_levels'], $rsnapshot::params::config_backup_levels, 'weekly')
@ -105,13 +108,12 @@ class rsnapshot::config (
} }
file { $exclude_file: file { $exclude_file:
ensure => file, ensure => 'file',
} }
file { $config: file { $config:
content => template('rsnapshot/rsnapshot.erb') content => template('rsnapshot/rsnapshot.erb')
} }
$cronfile = "${cron_dir}/${host}"
$cronfile = "/tmp/rsnapshot.d/cron/${host}"
concat { "${cronfile}": concat { "${cronfile}":
} }
$backup_levels.each |String $level| { $backup_levels.each |String $level| {

View File

@ -3,11 +3,11 @@
# default params # default params
class rsnapshot::params { class rsnapshot::params {
$hosts = undef $hosts = undef
$conf_d = '/tmp/rsnapshot.d' # the place where the host specific configs are stored $conf_d = '/etc/rsnapshot' # the place where the host specific configs are stored
$config_backup_user = 'root' $config_backup_user = 'root'
$package_name = 'rsnapshot' $package_name = 'rsnapshot'
$package_ensure = 'present' $package_ensure = 'present'
$cron_dir = '/tmp/rsnapshot.d/cron' $cron_dir = '/etc/cron.d'
$config_backup_levels = [ 'daily', 'weekly', ] $config_backup_levels = [ 'daily', 'weekly', ]
$config_backup_defaults = true $config_backup_defaults = true
$config_version = '1.2' $config_version = '1.2'