1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# modules/user/manifests/init.pp - manage user stuff
# Copyright (C) 2007 admin@immerda.ch
#
modules_dir { "user": }
class user {
}
define user::define_user(
$name,
$uid,
$gid,
$home_dir = '',
$ssh_key = ''
){
$real_ssh_key = $ssh_key ? {
'' => $name,
default => $ssh_key,
}
$real_home_dir = $home_dir ? {
'' => "/home/$name",
default => $home_dir
}
$real_name_comment = $name_comment ? {
'' => $name,
default => $name_comment,
}
user { $name:
allowdupe => false,
comment => "$real_name_comment"
ensure => present,
gid => $gid,
home => $real_home_dir,
shell => "/bin/bash",
uid => $uid
}
group { $name:
allowdupe => false,
ensure => present,
gid => $gid
}
file {
"$real_home_dir":
ensure => directory,
mode => 0750, owner => $name, group => $name;
}
ssh::deploy_auth_key($name: source => $real_ssh_key)
}
|