forked from puppetlabs/control-repo
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathaccounts.pp
More file actions
63 lines (61 loc) · 1.99 KB
/
Copy pathaccounts.pp
File metadata and controls
63 lines (61 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This class wraps the puppetlabs/accounts module and the native
# group type to create accounts and groups from hiera.
#
# Enteries in Hiera should look like this:
#
# accounts_hash:
# bob:
# uid: '4001'
# gid: '4001'
# shell: '/bin/bash'
# password: '!!'
# sshkeys:
# - 'ssh-rsa AAAA...'
# locked: false
# sue:
# uid: '4002'
# gid: '4002'
# shell: '/bin/ksh'
# password: '!!'
# sshkeys:
# - 'ssh-rsa BBBB...'
# locked: false
class profile::accounts (
$accounts = hiera_hash('accounts_hash',{}),
$groups = hiera_hash('groups_hash',{}),
) {
$accounts.each |$key, $value| {
accounts::user { $key:
ensure => $value['ensure'],
shell => $value['shell'],
comment => $value['comment'],
home => $value['home'],
home_mode => $value['home_mode'],
uid => $value['uid'],
gid => $value['gid'],
groups => $value['groups'],
membership => $value['membership'],
password => $value['password'],
locked => $value['locked'],
sshkeys => $value['sshkeys'],
managehome => $value['managehome'],
bashrc_content => $value['bashrc_content'],
bash_profile_content => $value['bash_profile_content'],
}
}
$groups.each |$key, $value| {
group { $key:
ensure => $value['ensure'],
allowdupe => $value['allowdupe'],
attribute_membership => $value['attribute_membership'],
attributes => $value['attributes'],
auth_membership => $value['auth_membership'],
forcelocal => $value['forcelocal'],
gid => $value['gid'],
ia_load_module => $value['ia_load_module'],
members => $value['members'],
provider => $value['provider'],
system => $value['system'],
}
}
}