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 # |
(...skipping 14 matching lines...) Expand all Loading... |
25 # authorized_keys => [ | 25 # authorized_keys => [ |
26 # 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA..................', | 26 # 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA..................', |
27 # 'from="10.0.8.2" ssh-rsa AAAAB3NzaC..................', | 27 # 'from="10.0.8.2" ssh-rsa AAAAB3NzaC..................', |
28 # ], | 28 # ], |
29 # groups => ['sudo', 'adm'], | 29 # groups => ['sudo', 'adm'], |
30 # password_hash => '$6$k.fe9F4U$OIav.SJ..................', | 30 # password_hash => '$6$k.fe9F4U$OIav.SJ..................', |
31 # } | 31 # } |
32 # | 32 # |
33 define adblockplus::user ( | 33 define adblockplus::user ( |
34 $authorized_keys = [], | 34 $authorized_keys = [], |
| 35 $ensure = 'present', |
35 $groups = [], | 36 $groups = [], |
36 $password_hash = undef, | 37 $password_hash = undef, |
37 ) { | 38 ) { |
38 | 39 |
39 include adblockplus | 40 include adblockplus |
40 include users | 41 include users |
41 | 42 |
42 users::user {"adblockplus::user#$name": | 43 # Re-used multiple times below |
43 authorized_keys => join($authorized_keys, "\n"), | 44 $home = "/home/$name" |
| 45 |
| 46 user {$name: |
| 47 ensure => $ensure, |
44 groups => $groups, | 48 groups => $groups, |
| 49 home => $home, |
| 50 managehome => true, |
45 password => $password_hash, | 51 password => $password_hash, |
46 user_name => $name, | 52 shell => '/bin/bash', |
| 53 } |
| 54 |
| 55 file {"$home/.ssh": |
| 56 ensure => $ensure ? { |
| 57 'present' => 'directory', |
| 58 default => $ensure, |
| 59 }, |
| 60 mode => 0700, |
| 61 owner => $name, |
| 62 require => User[$name], |
| 63 } |
| 64 |
| 65 file {"$home/.ssh/authorized_keys": |
| 66 content => join($authorized_keys, "\n"), |
| 67 ensure => $ensure, |
| 68 mode => 0644, |
| 69 owner => $name, |
| 70 require => File["$home/.ssh"], |
47 } | 71 } |
48 } | 72 } |
OLD | NEW |