]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
create ssh key for buildd
authorPeter Palfrader <peter@palfrader.org>
Sat, 14 Feb 2015 14:01:00 +0000 (15:01 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sat, 14 Feb 2015 14:01:00 +0000 (15:01 +0100)
modules/buildd/manifests/init.pp
modules/debian-org/lib/facter/roleaccounts.rb

index 2fe6b6a5e1cd0b238401696fe68875e1f3ce4caf..f11f6479295a91ef00d124cf83f844755452289f 100644 (file)
@@ -166,4 +166,11 @@ class buildd ($ensure=present) {
                owner   => buildd,
        }
 
+        if ! $::buildd_key {
+                exec { 'create-buildd-key':
+                        command => '/bin/su - buildd -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'',
+                        onlyif  => '/usr/bin/getent passwd buildd > /dev/null && ! [ -e /home/buildd/.ssh/id_rsa ]'
+                }
+        }
+
 }
index 9726919b38d6871e9c1e1af1113322e2075d1122..bb652f8cdb3f620ce703e4dd44553af64ee1e17a 100644 (file)
@@ -26,7 +26,6 @@ begin
     end
 
 
-
     Facter.add("weblogsync_key") do
         setcode do
             key = nil
@@ -51,6 +50,18 @@ begin
         end
     end
 
+    Facter.add("buildd_key") do
+        setcode do
+            key = nil
+            keyfile = '/home/buildd/.ssh/id_rsa.pub'
+            if FileTest.exist?(keyfile)
+                key = File.open(keyfile).read.chomp
+            end
+            key
+        end
+    end
+
+
 rescue Exception => e
 end
 # vim:set et: