| 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', | |
| 36 $groups = [], | 35 $groups = [], |
| 37 $password_hash = undef, | 36 $password_hash = undef, |
| 38 ) { | 37 ) { |
| 39 | 38 |
| 40 include adblockplus | 39 include adblockplus |
| 40 include users |
| 41 | 41 |
| 42 # Re-used multiple times below | 42 users::user {"adblockplus::user#$name": |
| 43 $home = "/home/$name" | 43 authorized_keys => join($authorized_keys, "\n"), |
| 44 | |
| 45 user {$name: | |
| 46 ensure => $ensure, | |
| 47 groups => $groups, | 44 groups => $groups, |
| 48 home => $home, | |
| 49 managehome => true, | |
| 50 password => $password_hash, | 45 password => $password_hash, |
| 51 shell => '/bin/bash', | 46 user_name => $name, |
| 52 } | |
| 53 | |
| 54 file {"$home/.ssh": | |
| 55 ensure => $ensure ? { | |
| 56 'present' => 'directory', | |
| 57 default => $ensure, | |
| 58 }, | |
| 59 mode => 0700, | |
| 60 owner => $name, | |
| 61 require => User[$name], | |
| 62 } | |
| 63 | |
| 64 file {"$home/.ssh/authorized_keys": | |
| 65 content => join($authorized_keys, "\n"), | |
| 66 ensure => $ensure, | |
| 67 mode => 0644, | |
| 68 owner => $name, | |
| 69 require => File["$home/.ssh"], | |
| 70 } | 47 } |
| 71 } | 48 } |
| OLD | NEW |