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
This commit is contained in:
Paul Belanger 2012-10-29 15:07:16 -04:00 committed by Jenkins
parent 49a29d9428
commit e05d91e80f
3 changed files with 45 additions and 40 deletions

View File

@ -1,6 +1,4 @@
class openstack_project::users { class openstack_project::users {
include user::virtual
@user::virtual::localuser { 'mordred': @user::virtual::localuser { 'mordred':
realname => 'Monty Taylor', realname => 'Monty Taylor',
sshkeys => "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyxfIpVCvZyM8BIy7r7WOSIG6Scxq4afean1Pc/bej5ZWHXCu1QnhGbI7rW3sWciEhi375ILejfODl2TkBpfdJe/DL205lLkTxAa+FUqcZ5Ymwe+jBgCH5XayzyhRPFFLn07IfA/BDAjGPqFLvq6dCEHVNJIui6oEW7OUf6a3376YF55r9bw/8Ct00F9N7zrISeSSeZXbNR+dEqcsBEKBqvZGcLtM4jzDzNXw1ITPPMGaoEIIszLpkkJcy8u/13GIrbAwNrB2wjl6Mzj+N9nTsB4rFtxRXp31ZbytCH5G9CL/mFard7yi8NLVEJPZJvAifNVhooxGN06uAiTFE8EsuQ== mtaylor@qualinost\n", sshkeys => "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyxfIpVCvZyM8BIy7r7WOSIG6Scxq4afean1Pc/bej5ZWHXCu1QnhGbI7rW3sWciEhi375ILejfODl2TkBpfdJe/DL205lLkTxAa+FUqcZ5Ymwe+jBgCH5XayzyhRPFFLn07IfA/BDAjGPqFLvq6dCEHVNJIui6oEW7OUf6a3376YF55r9bw/8Ct00F9N7zrISeSSeZXbNR+dEqcsBEKBqvZGcLtM4jzDzNXw1ITPPMGaoEIIszLpkkJcy8u/13GIrbAwNrB2wjl6Mzj+N9nTsB4rFtxRXp31ZbytCH5G9CL/mFard7yi8NLVEJPZJvAifNVhooxGN06uAiTFE8EsuQ== mtaylor@qualinost\n",

View File

@ -1,38 +0,0 @@
class user::virtual {
define localuser ($realname,$sshkeys='',$shell="/bin/bash") {
group { $title:
ensure => 'present'
}
user { $title:
ensure => "present",
comment => $realname,
home => "/home/$title",
shell => $shell,
gid => $title,
groups => ['sudo','admin'],
membership => 'minimum',
managehome => true, # creates the home directory (does not actually manage it)
require => Group[$title],
}
file { "${title}_sshdir":
name => "/home/$title/.ssh",
owner => $title,
group => $title,
mode => 700,
ensure => 'directory',
require => User[$title],
}
file { "${title}_keys":
name => "/home/$title/.ssh/authorized_keys",
owner => $title,
group => $title,
mode => 400,
content => $sshkeys,
ensure => 'present',
require => File["${title}_sshdir"],
}
}
}

View File

@ -0,0 +1,45 @@
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