We define users as such:
user { 'belmin':
ensure => present,
uid => 308,
comment => 'Belmin Fernandez',
managehome => true,
password => '$6$NrtZpXEauUqjdRh0$vE9oJwbNTSWVCGrlDe4KHXFB0KXY7hszSas3v0DZvhUej4SIb/WLfaCy.lmSU7Hh8AAvAbPuDRai2p1X9mDcM0',
}
I want to define a type that will look in the /etc/shadow
local to the puppet master and, if the user is there, use that password hash instead. Something like:
define our_user ($user = $title, $uid, $fullname, $default_hash) {
$shadow_hash = get_hash_from_local_shadown_somehow
if $shadow_hash == '' {
$shadow_hash = $default_hash
}
user { $user:
ensure => present,
uid => $uid,
comment => $fullname,
managehome => true,
password => $shadow_hash,
}
}
What would get_hash_from_local_shadown_somehow
be in this case? I see the file function in puppet
but unsure how to utilize that to address this since I'll need some more text processing.
Note: I know that centralized authentication would be the wisest avenue but that isn't an immediate option at the moment.