aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2012-11-30 21:27:14 +0100
committervarac <varacanero@zeromail.org>2012-11-30 23:03:46 +0100
commitd46db38c5346409838d77b24c7f74c1e72cb7caa (patch)
treea6c9d35a5d133d5c9f56ee0006572452e2199358
parent1bceb46bf91c05876edcc0f99a83ea5dbb4f977b (diff)
downloadpuppet-backupninja-d46db38c5346409838d77b24c7f74c1e72cb7caa.tar.gz
puppet-backupninja-d46db38c5346409838d77b24c7f74c1e72cb7caa.tar.bz2
possibilty to create a ssh keypair on the master
added following parameters to backupninja::duplicity and backupninja::client::key : $createkey $keystorefspath $keydest $keydestname
-rw-r--r--manifests/client.pp28
-rw-r--r--manifests/dup.pp24
2 files changed, 38 insertions, 14 deletions
diff --git a/manifests/client.pp b/manifests/client.pp
index 287b02f..3a2755b 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -46,8 +46,10 @@ class backupninja::client::defaults {
class backupninja::client inherits backupninja::client::defaults {
define key(
- $user = false, $host = false, $installkey=false, $keyowner=false,
- $keygroup=false, $keystore=false, $keytype=false)
+ $user = false, $host = false, $createkey=false, $installkey=false,
+ $keyowner=false, $keygroup=false, $keystore=false, $keystorefspath='',
+ $keytype=false,
+ $keydest=false, $keydestname=false )
{
$real_user = $user ? {
false => $name,
@@ -78,9 +80,23 @@ class backupninja::client inherits backupninja::client::defaults {
false => "${backupninja::client::defaults::real_keytype}",
default => $keytype,
}
+ $key_dest = $keydest ? {
+ false => "${backupninja::client::defaults::real_keydestination}",
+ default => $keydest,
+ }
+ $key_dest_name = $keydestname ? {
+ false => "id_$key_type",
+ default => $keydestname,
+ }
+ $key_dest_file = "${key_dest}/${key_dest_name}"
- $key_dest = "${backupninja::client::defaults::real_keydestination}"
- $key_dest_file = "$key_dest/id_$key_type"
+ if $createkey == true {
+ if $keystorefspath == false {
+ err("need to define a destination directory for sshkey creation!")
+ }
+ $ssh_keys = ssh_keygen("${keystorefspath}/${key_dest_name}")
+ }
+
case $install_key {
true: {
@@ -109,7 +125,7 @@ class backupninja::client::maildir inherits backupninja::client::defaults {
package { 'rsync':
ensure => $rsync_ensure_version,
}
- }
+ }
}
class backupninja::client::rdiff_backup inherits backupninja::client::defaults {
@@ -150,4 +166,4 @@ class backupninja::client::sys inherits backupninja::client::defaults {
}
default: {}
}
-}
+}
diff --git a/manifests/dup.pp b/manifests/dup.pp
index 23da8cd..5ffce29 100644
--- a/manifests/dup.pp
+++ b/manifests/dup.pp
@@ -79,7 +79,10 @@ define backupninja::duplicity( $order = 90,
$destuser = false,
# configs to backupninja client
$backupkeystore = false,
+ $backupkeystorefspath = '',
$backupkeytype = "rsa",
+ $backupkeydest = false,
+ $backupkeydestname = false,
# options to backupninja server sandbox
$ssh_dir_manage = true,
$ssh_dir = false,
@@ -87,6 +90,7 @@ define backupninja::duplicity( $order = 90,
$installuser = true,
$backuptag = false,
# key options
+ $createkey = false,
$installkey = true ) {
# the client with configs for this machine
@@ -95,7 +99,7 @@ define backupninja::duplicity( $order = 90,
case $desthost { false: { err("need to define a destination host for remote backups!") } }
case $destdir { false: { err("need to define a destination directory for remote backups!") } }
case $password { false: { err("a password is necessary either to unlock the GPG key, or for symmetric encryption!") } }
-
+
# guarantees there's a configured backup space for this backup
backupninja::server::sandbox { "${user}-${name}":
user => $destuser,
@@ -109,14 +113,18 @@ define backupninja::duplicity( $order = 90,
backupkeys => $backupkeystore,
keytype => $backupkeytype,
}
-
+
# the client's ssh key
backupninja::client::key { "${destuser}-${name}":
- user => $destuser,
- host => $desthost,
- installkey => $installkey,
- keytype => $backupkeytype,
- keystore => $backupkeystore,
+ user => $destuser,
+ host => $desthost,
+ createkey => $createkey,
+ installkey => $installkey,
+ keytype => $backupkeytype,
+ keystore => $backupkeystore,
+ keystorefspath => $backupkeystorefspath,
+ keydest => $backupkeydest,
+ keydestname => $backupkeydestname
}
# the backupninja rule for this duplicity backup
@@ -129,4 +137,4 @@ define backupninja::duplicity( $order = 90,
require => File["${backupninja::client::defaults::configdir}"]
}
}
-
+