OLD | NEW |
1 # == Type: adblockplus::user | 1 # == Type: adblockplus::user |
2 # | 2 # |
3 # Manage user accounts. | 3 # Manage user accounts. |
4 # | 4 # |
5 # === Parameters: | 5 # === Parameters: |
6 # | 6 # |
7 # [*authorized_keys*] | 7 # [*authorized_keys*] |
8 # A list of zero or more lines for the ~/.ssh/authorized_keys file of | 8 # A list of zero or more lines for the ~/.ssh/authorized_keys file of |
9 # the respective user. Used as-is, joined by newline characters. | 9 # the respective user. Used as-is, joined by newline characters. |
10 # | 10 # |
11 # [*groups*] | 11 # [*groups*] |
12 # A list of zero or more groups (names), to assign the user to. | 12 # A list of zero or more groups (names), to assign the user to. |
13 # | 13 # |
14 # [*name*] | 14 # [*name*] |
15 # The name of the user account, defaults to $title. | 15 # The name of the user account, defaults to $title. |
16 # | 16 # |
17 # [*password_hash*] | 17 # [*password_hash*] |
18 # The user's password, as lexical SHA1 hashsum. If undefined, Puppet | 18 # The user's password, as lexical SHA1 hashsum. If undefined, Puppet |
19 # won't change the current one, if any. Use "*" to disable the user's | 19 # won't change the current one, if any. Use "*" to disable the user's |
20 # password explicitly. | 20 # password explicitly. |
21 # | 21 # |
| 22 # [*shell*] |
| 23 # The path to the user's login shell. |
| 24 # |
22 # === Examples: | 25 # === Examples: |
23 # | 26 # |
24 # adblockplus::user {'pinocchio': | 27 # adblockplus::user {'pinocchio': |
25 # authorized_keys => [ | 28 # authorized_keys => [ |
26 # 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA..................', | 29 # 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA..................', |
27 # 'from="10.0.8.2" ssh-rsa AAAAB3NzaC..................', | 30 # 'from="10.0.8.2" ssh-rsa AAAAB3NzaC..................', |
28 # ], | 31 # ], |
29 # groups => ['sudo', 'adm'], | 32 # groups => ['sudo', 'adm'], |
30 # password_hash => '$6$k.fe9F4U$OIav.SJ..................', | 33 # password_hash => '$6$k.fe9F4U$OIav.SJ..................', |
| 34 # shell => '/bin/ksh', |
31 # } | 35 # } |
32 # | 36 # |
33 define adblockplus::user ( | 37 define adblockplus::user ( |
34 $authorized_keys = [], | 38 $authorized_keys = [], |
35 $ensure = 'present', | 39 $ensure = 'present', |
36 $groups = [], | 40 $groups = [], |
37 $password_hash = undef, | 41 $password_hash = undef, |
| 42 $shell = '/bin/bash', |
38 ) { | 43 ) { |
39 | 44 |
40 include adblockplus | 45 include adblockplus |
41 | 46 |
42 # Re-used multiple times below | 47 # Re-used multiple times below |
43 $home = "/home/$name" | 48 $home = "/home/$name" |
44 | 49 |
45 user {$name: | 50 user {$name: |
46 ensure => $ensure, | 51 ensure => $ensure, |
47 groups => $groups, | 52 groups => $groups, |
48 home => $home, | 53 home => $home, |
49 managehome => true, | 54 managehome => true, |
50 password => $password_hash, | 55 password => $password_hash, |
51 shell => '/bin/bash', | 56 shell => $shell, |
52 } | 57 } |
53 | 58 |
54 file {"$home/.ssh": | 59 file {"$home/.ssh": |
55 ensure => $ensure ? { | 60 ensure => $ensure ? { |
56 'present' => 'directory', | 61 'present' => 'directory', |
57 default => $ensure, | 62 default => $ensure, |
58 }, | 63 }, |
59 mode => '0700', | 64 mode => '0700', |
60 owner => $name, | 65 owner => $name, |
61 require => User[$name], | 66 require => User[$name], |
62 } | 67 } |
63 | 68 |
64 file {"$home/.ssh/authorized_keys": | 69 file {"$home/.ssh/authorized_keys": |
65 content => join($authorized_keys, "\n"), | 70 content => join($authorized_keys, "\n"), |
66 ensure => $ensure, | 71 ensure => $ensure, |
67 mode => '0644', | 72 mode => '0644', |
68 owner => $name, | 73 owner => $name, |
69 require => File["$home/.ssh"], | 74 require => File["$home/.ssh"], |
70 } | 75 } |
71 } | 76 } |
OLD | NEW |