diff options
-rw-r--r-- | manifests/client.pp | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index aa74e29..daa2e16 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,7 +4,7 @@ class backupninja::client { default => $cfg_override, } $real_keystore = $backupkeystore ? { - '' => '$fileserver/keys/backupkeys', + '' => "$fileserver/keys/backupkeys", default => $backupkeystore, } $real_keytype = $backupkeytype ? { @@ -24,30 +24,50 @@ class backupninja::client { default => $keygroup, } $real_keymanage = $keymanage ? { - '' => true, + '' => 'doit', default => $keymanage } + err("$real_keystore $real_keytype $real_keydestination $real_keyowner $real_keygroup $real_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 ) + define key ( $host=$user, $installkeys=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false ) { - case $installkey { - true: { - file { "$destination": + $install_keys = $installkeys ? { + false => "${backupninja::client::real_keymanage}", + default => $installkeys, + } + $key_owner = $keyowner ? { + false => "${backupninja::client::real_keyowner}", + default => $keyowner, + } + $key_group = $keygroup ? { + false => "${backupninja::client::real_keygroup}", + default => $keygroup, + } + $key_store = $keystore ? { + false => "${backupninja::client::real_keystore}", + default => $keystore, + } + $key_type = $keytype ? { + false => "${backupninja::client::real_keytype}", + default => $keytype, + } + + + case $install_keys { + 'doit': { + file { "${backupninja::client::real_keydestination}": ensure => directory, - mode => 700, owner => $keyowner, group => $keygroup, + mode => 700, owner => $key_owner, group => $key_group, } - file { "$destination/id_$keytype": - source => "$sourcekey", - mode => 0400, owner => $keyowner, group => $keygroup, - require => File["$destination"], + file { "${backupninja::client::real_keydestination}/id_${key_type}": + source => "${key_store}/${host}_id_${key_type}", + mode => 0400, owner => $key_owner, group => $key_group, + require => File["${backupninja::client::real_keydestination}"], } } } |