I'm using vagrant+puppet to provision a precise32
VirtualBox server to add users programatically. I've got everything working but I can't seem to set the password automatically by puppet. Here's my puppet script:
package { "ruby-shadow":
name => "libshadow-ruby1.8",
ensure => installed,
}
user { 'biff':
home => '/home/biff',
shell => '/bin/bash',
uid => 201,
managehome => 'true',
password => '$6$kxHLEuHW$zHRAZcVLu0XzukqU79bT.PEg./FfcloJiWmlH2rf.Lmnyke7uAaHkQTXvErqikWeraSiHFBwDSMDV4hRImqjr7.',
groups => ['sudo', ],
requires => Package['ruby-shadow'],
}
To get the hash $6$kx...
, I logged into the virtual machine, ran sudo passwd biff
to set the password with the system, and then copied the hashed password (second field in /etc/shadow
) into the puppet script above. After removing the user to reset the password and rerunning the puppet script, the password isn't set and I can't login at all:
[precise32]$ sudo grep biff /etc/shadow
biff:!:15862:0:99999:7:::
In fact, it looks like the user biff
has been locked out of the system (/etc/shadow explanation). Do I have the correct hash set as the password
variable? How do you figure out what that is?
It looks like one approach might be to run usermod
after the fact to set the password, but that seems to be against the entire point of using puppet in the first place. Any ideas?