Nerdier

Adjective: Comparative form of nerdy: more nerdy.

Creating users with Puppet.

It’s fairly simple to add system users with puppet to servers, however I had to do a little bit of googling to find some working examples so I will put it here for future reference.

I have only used this on RHEL

To add a user you just need to do;

user { "craig":
    ensure => present,
    home => "/home/craig",
    managehome => true,
    groups => "wheel",
    password => '$1$Ou68nHrs$wVIySKVIkoMhJEzCAoqpd/',
}

The password needs to be in md5 format, I used md5pass on my ubuntu desktop to generate the hashes, but you can use whichever method you prefer.

To add an authorized ssh key for a user, you just need to do the following;

The key looks like this;

ssh-rsa AAAAB3N............sdfESEaHARRr= craig@nerdier.co.uk

So the puppet format is;

ssh_authorized_key{ "craig@nerdier.co.uk":
    ensure => present,
    key => "AAAAB3N............sdfESEaHARRr=",
    type => ssh-rsa,
    user => craig,
}

Leave a Reply

Your email address will not be published. Required fields are marked *