aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/client.pp12
-rw-r--r--manifests/rdiff.pp7
-rw-r--r--manifests/server.pp10
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",