system-config/modules/user/manifests/virtual/localuser.pp
Paul Belanger e05d91e80f Create localuser.pp
This is a sytle guide update for puppet.  Including definations within a
class is not recommented.

Change-Id: Id108d61dade1f99350691627236f1a13c12c10bc
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-on: https://review.openstack.org/14986
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
2012-11-10 23:50:17 +00:00

46 lines
969 B
Puppet

define user::virtual::localuser(
$realname,
$sshkeys = '',
$shell = '/bin/bash'
) {
group { $title:
ensure => present,
}
user { $title:
ensure => present,
comment => $realname,
gid => $title,
groups => [
'sudo',
'admin',
],
home => "/home/${title}",
managehome => true, # creates home directory, does not manage it
membership => 'minimum',
require => Group[$title],
shell => $shell,
}
file { "${title}_sshdir":
ensure => directory,
name => "/home/${title}/.ssh",
owner => $title,
group => $title,
mode => '0700',
require => User[$title],
}
file { "${title}_keys":
ensure => present,
content => $sshkeys,
group => $title,
mode => '0400',
name => "/home/${title}/.ssh/authorized_keys",
owner => $title,
require => File["${title}_sshdir"],
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79