]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Manage ssh private keys with ssh_local_key
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 13 Apr 2014 21:57:08 +0000 (18:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 13 Apr 2014 21:57:08 +0000 (18:57 -0300)
manifests/init.pp

index 68c259188be9b598a00811db11b0dfd490c15497..34d8c88804f9c673fa6160f4ba15c988037a2f8d 100644 (file)
@@ -193,7 +193,7 @@ class backup(
   }
 
   # default backupninja::rdiff configuration
-  define rdiff($port = '22', $ensure = present, $installkey = true) {
+  define rdiff($port = '22', $ensure = present) {
     backupninja::rdiff { "rdiff-$title.$domain":
       ensure         => $ensure,
       options        => "--remote-schema 'ssh -p $port -C %s rdiff-backup --server'",
@@ -208,27 +208,34 @@ class backup(
       subfolder      => "rdiff",
       user           => "$hostname",
       sshoptions     => "-p $port",
-      installkey     => $installkey,
+      installkey     => false,
       backupkeytype  => "rsa",
-      backupkeystore => "puppet:///ssh",
+      backupkeystore => "puppet:///pubkeys",
+    }
+
+    if !defined(Ssh_local_key['backup']) {
+      ssh_local_key { 'backup':
+        owner => root,
+        group => root,
+        home  => /root,
+      }
     }
   }
 
   define rsync($port           = '22',
                $ensure         = present,
-               $installkey     = true,
                $bandwidthlimit = false,
                $use_domain     = $::domain,
                $use_fqdn       = $::fqdn) {
     backupninja::rsync { "rsync-$title.$use_domain":
       # [general]
       ensure         => $ensure,
-      installkey     => $installkey,
+      installkey     => false,
       home           => "$backupdir/remote/$use_fqdn",
       backupdir      => "$backupdir/remote/$use_fqdn/rsync",
       backupkeytype  => "rsa",
       id_file        => "/root/.ssh/id_rsa",
-      backupkeystore => "puppet:///ssh",
+      backupkeystore => "puppet:///pubkeys",
       keepdaily      => '4',
       keepweekly     => '2',
       keepmonthly    => '2',
@@ -246,6 +253,14 @@ class backup(
       compress       => '1',
       testconnect    => 'yes',
     }
+
+    if !defined(Ssh_local_key['backup']) {
+      ssh_local_key { 'backup':
+        owner => root,
+        group => root,
+        home  => /root,
+      }
+    }
   }
 
   # local backups using duplicity