diff options
-rw-r--r-- | manifests/client.pp | 9 | ||||
-rw-r--r-- | manifests/rdiff.pp | 7 | ||||
-rw-r--r-- | manifests/server.pp | 92 |
3 files changed, 60 insertions, 48 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index 6942299..841ae99 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -33,7 +33,7 @@ class backupninja::client { file { $configdir: ensure => directory } - define key ( $user = false, $host = false, $installkeys=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false ) + define key ( $user = false, $host = false, $installkey=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false ) { $real_user = $user ? { false => $name, @@ -43,9 +43,9 @@ class backupninja::client { false => $user, default => $host } - $install_keys = $installkeys ? { + $install_key = $installkey ? { false => "${backupninja::client::real_keymanage}", - default => $installkeys, + default => $installkey, } $key_owner = $keyowner ? { false => "${backupninja::client::real_keyowner}", @@ -64,8 +64,7 @@ class backupninja::client { default => $keytype, } - - case $install_keys { + case $install_key { 'doit': { file { "${backupninja::client::real_keydestination}": ensure => directory, diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index aec4d96..978b961 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -26,14 +26,15 @@ define backupninja::rdiff($order = 90, $keep = 30, $sshoptions = false, $options = false, - $installkeys = true + $installuser = true, + $installkey = 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}-${name}": user => $user, host => $host, installkeys => $installkeys } + backupninja::server::sandbox { "${user}-${name}": user => $user, host => $host, dir => $directory, installuser => $installuser } + backupninja::client::key { "${user}-${name}": user => $user, host => $host, installkey => $installkey } } } file { "${backupninja::client::configdir}/${order}_${name}.rdiff": diff --git a/manifests/server.pp b/manifests/server.pp index 3952ae3..c539399 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -3,6 +3,10 @@ class backupninja::server { '' => "/backup", default => $backupdir, } + $real_usermanage = $usermanage ? { + '' => 'doit', + default => $usermanage + } $real_backupserver_tag = $backupserver_tag ? { '' => $fqdn, default => $backupserver_tag @@ -20,7 +24,7 @@ class backupninja::server { # this define allows nodes to declare a remote backup sandbox, that have to # get created on the server - define sandbox($user = false, $host = false, $dir = false, $backupkeys = false, $uid = false, $gid = "backupninjas") { + define sandbox($user = false, $host = false, $installuser=false, $dir = false, $backupkeys = false, $uid = false, $gid = "backupninjas") { $real_user = $name ? { false => $name, default => $user, @@ -30,6 +34,10 @@ class backupninja::server { false => $fqdn, default => $host, } + $install_user = $installuser ? { + false => "${backupninja::server::real_usermanage}", + default => $installuser, + } $real_backupkeys = $backupkeys ? { false => "$fileserver/keys/backupkeys", default => $backupkeys, @@ -43,46 +51,50 @@ class backupninja::server { mode => 750, owner => $user, group => 0, tag => "backupninja-$real_host", } - @@file { "$real_dir/.ssh": - ensure => directory, - 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/${user}_id_rsa.pub", - require => File["$real_dir/.ssh"], - tag => "backupninja-$real_host", - } - - case $uid { - false: { - @@user { "$user": - ensure => "present", - gid => "$gid", - comment => "$name backup sandbox", - home => "$real_dir", - managehome => true, - shell => "/bin/sh", - password => '*', - require => Group['backupninjas'], - tag => "backupninja-$real_host" + case $install_user { + 'doit': { + @@file { "$real_dir/.ssh": + ensure => directory, + mode => 700, owner => $user, group => 0, + require => File["$real_dir"], + tag => "backupninja-$real_host", } - } - default: { - @@user { "$user": - ensure => "present", - uid => "$uid", - gid => "$gid", - comment => "$name backup sandbox", - home => "$real_dir", - managehome => true, - shell => "/bin/sh", - password => '*', - require => Group['backupninjas'], - tag => "backupninja-$real_host" + @@file { "$real_dir/.ssh/authorized_keys": + ensure => present, + mode => 644, owner => 0, group => 0, + source => "$real_backupkeys/${user}_id_rsa.pub", + require => File["$real_dir/.ssh"], + tag => "backupninja-$real_host", + } + + case $uid { + false: { + @@user { "$user": + ensure => "present", + gid => "$gid", + comment => "$name backup sandbox", + home => "$real_dir", + managehome => true, + shell => "/bin/sh", + password => '*', + require => Group['backupninjas'], + tag => "backupninja-$real_host" + } + } + default: { + @@user { "$user": + ensure => "present", + uid => "$uid", + gid => "$gid", + comment => "$name backup sandbox", + home => "$real_dir", + managehome => true, + shell => "/bin/sh", + password => '*', + require => Group['backupninjas'], + tag => "backupninja-$real_host" + } + } } } } |