diff options
author | Micah Anderson <micah@riseup.net> | 2008-05-30 17:43:51 +0000 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2008-05-30 17:43:51 +0000 |
commit | 100bb69f2e721332e71e4e5bf8dd96cf3499296c (patch) | |
tree | 26e540ec4786e0c033f56c44294a9a3977cc014b | |
parent | d08410db8a81ce6060eea2044c0ac09c001568ab (diff) | |
download | puppet-backupninja-100bb69f2e721332e71e4e5bf8dd96cf3499296c.tar.gz puppet-backupninja-100bb69f2e721332e71e4e5bf8dd96cf3499296c.tar.bz2 |
change the backupninja::client::key definition to use the $user variable
change the $host variable to no longer use the $user variable, that way
multiple rdiff's can be instantiated for a particular host, with different
name variables
in order to do that, the class also has to have the $installkeys variable that
can be passed to backupninja::client::key so that the second rdiff instantiation would
set installkeys => false, otherwise there will be an attempt to duplicate the resource
-rw-r--r-- | manifests/client.pp | 12 | ||||
-rw-r--r-- | manifests/rdiff.pp | 7 | ||||
-rw-r--r-- | manifests/server.pp | 10 |
3 files changed, 19 insertions, 10 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index 67191d9..6942299 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -33,8 +33,16 @@ class backupninja::client { file { $configdir: ensure => directory } - define key ( $host=$user, $installkeys=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false ) + define key ( $user = false, $host = false, $installkeys=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false ) { + $real_user = $user ? { + false => $name, + default => $user + } + $real_host = $host ? { + false => $user, + default => $host + } $install_keys = $installkeys ? { false => "${backupninja::client::real_keymanage}", default => $installkeys, @@ -64,7 +72,7 @@ class backupninja::client { mode => 700, owner => $key_owner, group => $key_group, } file { "${backupninja::client::real_keydestination}/id_${key_type}": - source => "${key_store}/${host}_id_${key_type}", + source => "${key_store}/${real_user}_id_${key_type}", mode => 0400, owner => $key_owner, group => $key_group, require => File["${backupninja::client::real_keydestination}"], } diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index 02f72e6..aec4d96 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -25,14 +25,15 @@ define backupninja::rdiff($order = 90, $include = [ "/var/spool/cron/crontabs", "/var/backups", "/etc", "/root", "/home", "/usr/local/*bin", "/var/lib/dpkg/status*" ], $keep = 30, $sshoptions = false, - $options = false + $options = false, + $installkeys = true ) { include backupninja::client case $type { 'remote': { case $host { false: { err("need to define a host for remote backups!") } } - backupninja::server::sandbox { $user-$name: user => $user, host => $host, dir => $directory } - backupninja::client::key { $user: } + backupninja::server::sandbox { "${user}-${name}": user => $user, host => $host, dir => $directory } + backupninja::client::key { "${user}-${name}": user => $user, host => $host, installkeys => $installkeys } } } file { "${backupninja::client::configdir}/${order}_${name}.rdiff": diff --git a/manifests/server.pp b/manifests/server.pp index dbeeca0..3952ae3 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -40,26 +40,26 @@ class backupninja::server { } @@file { "$real_dir": ensure => directory, - mode => 750, owner => $name, group => 0, + mode => 750, owner => $user, group => 0, tag => "backupninja-$real_host", } @@file { "$real_dir/.ssh": ensure => directory, - mode => 700, owner => $name, group => 0, + mode => 700, owner => $user, group => 0, require => File["$real_dir"], tag => "backupninja-$real_host", } @@file { "$real_dir/.ssh/authorized_keys": ensure => present, mode => 644, owner => 0, group => 0, - source => "$real_backupkeys/${name}_id_rsa.pub", + source => "$real_backupkeys/${user}_id_rsa.pub", require => File["$real_dir/.ssh"], tag => "backupninja-$real_host", } case $uid { false: { - @@user { "$name": + @@user { "$user": ensure => "present", gid => "$gid", comment => "$name backup sandbox", @@ -72,7 +72,7 @@ class backupninja::server { } } default: { - @@user { "$name": + @@user { "$user": ensure => "present", uid => "$uid", gid => "$gid", |