1 class base_installation::users (
2 $users = $base_installation::system_users,
3 ) inherits base_installation {
4 ensure_packages('ruby-shadow')
7 purge_ssh_keys => ["/root/.ssh/authorized_keys"],
11 config_file_replace => false,
12 # Missing in the sudo package, should no be mandatory
18 content => "%wheel ALL=(ALL) ALL",
19 require => Package["sudo"],
25 if ($user["username"] != "root") {
26 unless $user["shell"] == undef or empty($user["shell"]) {
27 ensure_packages([$user["shell"]])
28 $shell = "/bin/${user[shell]}"
33 user { "${user[username]}:${user[userid]}":
34 name => $user[username],
37 groups => $user[groups],
39 system => !!$user[system],
40 home => "/home/${user[username]}",
42 notify => Exec["remove_password:${user[username]}:${user[userid]}"],
43 purge_ssh_keys => true
46 exec { "remove_password:${user[username]}:${user[userid]}":
47 command => "/usr/bin/chage -d 0 ${user[username]} && /usr/bin/passwd -d ${user[username]}",
48 onlyif => "/usr/bin/test -z '${user[password]}'",
53 if has_key($user, "keys") {
54 $user[keys].each |$key| {
55 if has_key($key, "command") {
56 ssh_authorized_key { "${user[username]}@${key[host]}":
57 name => "${user[username]}@${key[host]}",
58 user => $user[username],
59 type => $key[key_type],
62 "command=\"${key[command]}\"",
69 ssh_authorized_key { "${user[username]}@${key[host]}":
70 name => "${user[username]}@${key[host]}",
71 user => $user[username],
72 type => $key[key_type],