I use the following plugin :

module Puppet::Parser::Functions
  newfunction(:getPassword, :type => :rvalue) do |args|
      clientHostname = args[0]
      type = args[1]
      len = args[2]
      filename = "/var/lib/puppet/passwords/" + clientHostname + "-" +
type + ".pass"

      def newpass( len )
          chars = ("A".."Z").to_a + ("a".."z").to_a + ("0".."9").to_a
          newpass = Array.new(len) { chars[rand(chars.size)] }.join
          return newpass
      end

      thePass = ""
      if File.exist? filename
          theFile = File.new(filename, "r")
          theFile.each_line {|line| thePass = line }
          theFile.close
      else
          thePass = newpass ( len.to_i )
          theFile = File.new(filename, "w+")
          theFile.print thePass
          theFile.chmod(0600)
          theFile.close
      end

      return thePass
  end
end


It store the password on the puppetmaster and you can have it as a
variable with :
$adminPassword = getPassword($hostname, "myapppass", "12")

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to