Re: [Puppet Users] Creating user with random password (only once)

Jeff McCune
Wed, 08 Feb 2012 19:58:33 -0000

On Wed, Feb 8, 2012 at 11:30 AM, wernerbahlke
<werner.bahlke@gmail.com>wrote:

> Hi,
>
> I want to create a user with a random password. Is there a way to only
> execute the manifest once when the user does not exist but not once
> the user is created?
>

For situations like this I use the puppet generate() function to create the
random password and store it in a persistent data store on the master.
 e.g. an SQLITE database or something.  This way, the password is generated
randomly if it does not exist and the same password is used if it does
already exist.

It''s important to have the resource always be managed, that way if the
password is changed on the managed node Puppet will realize this, change it
to the value you''re managing, and report that it did so.

-Jeff