aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/manifests/users.pp
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-13 13:23:17 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-13 22:51:36 +0100
commit0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c (patch)
tree95af1b06a4b8d67759628071f163b3d42c9c7f22 /modules/base_installation/manifests/users.pp
parent96d61e22a20255c2b437eb3a3b81f9b44a1814de (diff)
downloadPuppet-0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c.tar.gz
Puppet-0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c.tar.zst
Puppet-0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c.zip
Start to cleanup the files
Diffstat (limited to 'modules/base_installation/manifests/users.pp')
-rw-r--r--modules/base_installation/manifests/users.pp20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/base_installation/manifests/users.pp b/modules/base_installation/manifests/users.pp
index 766c0f0..f893c51 100644
--- a/modules/base_installation/manifests/users.pp
+++ b/modules/base_installation/manifests/users.pp
@@ -26,22 +26,26 @@ class base_installation::users (
26 ensure => "present", 26 ensure => "present",
27 groups => $user[groups], 27 groups => $user[groups],
28 managehome => true, 28 managehome => true,
29 system => !!$user[system],
29 home => "/home/${user[username]}", 30 home => "/home/${user[username]}",
30 notify => Exec["remove_password"], 31 notify => Exec["remove_password:${user[username]}:${user[userid]}"],
31 purge_ssh_keys => true 32 purge_ssh_keys => true
32 } 33 }
33 34
34 exec { "remove_password": 35 exec { "remove_password:${user[username]}:${user[userid]}":
35 command => "/usr/bin/chage -d 0 ${user[username]} && /usr/bin/passwd -d ${user[username]}", 36 command => "/usr/bin/chage -d 0 ${user[username]} && /usr/bin/passwd -d ${user[username]}",
37 onlyif => "/usr/bin/test -z '${user[password]}'",
36 refreshonly => true 38 refreshonly => true
37 } 39 }
38 40
39 $user[keys].each |$key| { 41 if has_key($user, "keys") {
40 ssh_authorized_key { "${user[username]}@${key[host]}": 42 $user[keys].each |$key| {
41 name => "${user[username]}@${key[host]}", 43 ssh_authorized_key { "${user[username]}@${key[host]}":
42 user => $user[username], 44 name => "${user[username]}@${key[host]}",
43 type => $key[key_type], 45 user => $user[username],
44 key => $key[key], 46 type => $key[key_type],
47 key => $key[key],
48 }
45 } 49 }
46 } 50 }
47 } 51 }