system-config/modules/user/manifests/virtual/localuser.pp
Jeremy Stanley 2a9412670c Stop over-managing user SSH keyfiles
* modules/user/manifests/virtual/localuser.pp: This reverts part of
0d82c62 which was providing a temporary transition correcting
permissions and ownership as well as removing the results of a
previous failed implementation of keyfile management. Unfortunately
that also caused nodepool images to no longer set up accounts
correctly, but reverting the transitional bits fixes that issue.

Change-Id: Ic3e7f0a3b82bbc8a23707b88f9fe381e9d70e356
2014-04-30 20:11:16 +00:00

48 lines
902 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}",
$managehome = true
) {
group { $title:
ensure => present,
}
user { $title:
ensure => present,
comment => $realname,
gid => $title,
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