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
|
# File 'manifests/passwd.pp', line 6
class splunk::passwd (
$admin = $splunk::admin,
$splunk_home = $splunk::splunk_home,
$splunk_os_user = $splunk::real_splunk_os_user,
$splunk_os_group = $splunk::real_splunk_os_group,
$splunk_dir_mode = $splunk::real_splunk_dir_mode,
$splunk_file_mode = $splunk::real_splunk_file_mode
){
case $::osfamily {
/^[Ww]indows$/: {
notify {'Setting admin password not supported on Windows':}
warning('Setting admin password not supported on Windows')
}
default: {
if $admin != undef {
if $admin[hash] != undef {
$hash = $admin[hash]
$fn = $admin[fn] ? {
undef => '',
default => $admin[fn]
}
$email = $admin[email] ? {
undef => '',
default => $admin[email]
}
file { "${splunk_home}/etc/passwd":
ensure => present,
owner => $splunk_os_user,
group => $splunk_os_group,
mode => $splunk_dir_mode,
content => ':admin:::',
replace => 'no',
}
-> exec { 'set admin passwd':
command => "sed -i -e 's#^:admin:.*$#:admin:${hash}::${fn}:admin:${email}::#g' ${splunk_home}/etc/passwd",
unless => "grep -qe '^:admin:${hash}' ${splunk_home}/etc/passwd",
path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
}
-> file { "${splunk_home}/etc/.ui_login":
ensure => present,
owner => $splunk_os_user,
group => $splunk_os_group,
mode => $splunk_file_mode,
content => '',
replace => 'no',
}
}
}
}
}
}
|