
Set uid and gid values for users that puppet creates so they are consistent across all systems. Pick some arbitrary values for them and set them for all current users. Remove users who haven't been around for a while (their ssh keys should all be removed at this point). I do not know what puppet will do with existing users (whether it will attempt to change their entries or not), so do not merge this change until all existing servers have been updated. Change-Id: Id77e767af792f41fe2f8551953a2cf621323b373
52 lines
990 B
Puppet
52 lines
990 B
Puppet
# usage
|
|
#
|
|
# user::virtual::localuser['username']
|
|
|
|
define user::virtual::localuser(
|
|
$realname,
|
|
$groups = [ 'sudo', 'admin', ],
|
|
$sshkeys = '',
|
|
$key_id = '',
|
|
$old_keys = [],
|
|
$shell = '/bin/bash',
|
|
$home = "/home/${title}",
|
|
$uid = unset,
|
|
$gid = unset,
|
|
$managehome = true
|
|
) {
|
|
|
|
group { $title:
|
|
ensure => present,
|
|
gid => $gid,
|
|
}
|
|
|
|
user { $title:
|
|
ensure => present,
|
|
comment => $realname,
|
|
uid => $uid,
|
|
gid => $gid,
|
|
groups => $groups,
|
|
home => $home,
|
|
managehome => $managehome,
|
|
membership => 'minimum',
|
|
shell => $shell,
|
|
require => Group[$title],
|
|
}
|
|
|
|
ssh_authorized_key { $key_id:
|
|
ensure => present,
|
|
key => $sshkeys,
|
|
user => $title,
|
|
type => 'ssh-rsa',
|
|
}
|
|
|
|
if ( $old_keys != [] ) {
|
|
ssh_authorized_key { $old_keys:
|
|
ensure => absent,
|
|
user => $title,
|
|
}
|
|
}
|
|
}
|
|
|
|
# vim:sw=2:ts=2:expandtab:textwidth=79
|