diff options
-rw-r--r-- | manifests/client.pp | 44 | ||||
-rw-r--r-- | manifests/rdiff.pp | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index fed83e6..fb0c934 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,10 +3,54 @@ class backupninja::client { '' => "/etc/backup.d", default => $cfg_override, } + $real_keystore = $backupkeystore ? { + '' => '$fileserver/keys/backupkeys', + default => $backupkeystore, + } + $real_keytype = $backupkeytype ? { + '' => 'rsa', + default => $backupkeytype, + } + $real_keydestination = $keydestination ? { + '' => '/root/.ssh', + default => $keydestination, + } + $real_keyowner = $keyowner ? { + '' => 0, + default => $keyowner, + } + $real_keygroup = $keygroup ? { + '' => 0, + default => $keygroup, + } + $real_keymanage = $keymanage ? { + '' => true, + default => $keymanage + } package { 'backupninja': ensure => '0.9.5-3'; } file { $configdir: ensure => directory } + define key ( + $sourcekey='$real_keystore/${name}_id_$real_keytype', + $destination='$real_keydestination', $key_type=$real_keytype, + $key_owner=$real_keyowner, $key_group=$real_keygroup, $installkey=$real_keymanage + ) + case $installkey { + true: { + { + file { "$destination": + ensure => directory, + mode => 700, owner => $keyowner, group => $keygroup, + } + file { "$destination/id_$keytype": + source => "$sourcekey", + mode => 0400, owner => $keyowner, group => $keygroup, + require => File["$destination"], + } + } + } + } } diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index 6e81ab2..888d774 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -32,6 +32,7 @@ define backupninja::rdiff($order = 90, 'remote': { case $host { false: { err("need to define a host for remote backups!") } } backupninja::server::sandbox { $user: host => $host, dir => $directory } + backupninja::client::key { $user } } } file { "${backupninja::client::configdir}/${order}_${name}.rdiff": |