Puppet Class: splunk::splunk_launch

Defined in:
manifests/splunk_launch.pp

Overview

Parameters:

  • splunk_os_user (Any) (defaults to: $splunk::real_splunk_os_user)
  • splunk_bindip (Any) (defaults to: $splunk::splunk_bindip)
  • splunk_db (Any) (defaults to: $splunk::splunk_db)
  • splunk_home (Any) (defaults to: $splunk::splunk_home)


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
64
65
66
67
68
69
70
71
72
73
74
# File 'manifests/splunk_launch.pp', line 6

class splunk::splunk_launch (
  $splunk_os_user = $splunk::real_splunk_os_user,
  $splunk_bindip = $splunk::splunk_bindip,
  $splunk_db = $splunk::splunk_db,
  $splunk_home = $splunk::splunk_home
){
  case $::osfamily {
    /^[Ww]indows$/: {
      notify {'Setting splunk_os_user and splunk_db not supported on Windows':}
      warning('Setting splunk_os_user and splunk_db not supported on Windows')
      # On Windows there is no Augeas
    }
    default: {
      if $splunk_os_user == undef {
        augeas { "${splunk_home}/etc/splunk-launch.conf splunk_os_user":
          lens    => 'ShellVars.lns',
          incl    => "${splunk_home}/etc/splunk-launch.conf",
          changes => [
            'rm SPLUNK_OS_USER',
          ];
        }
      } else {
        augeas { "${splunk_home}/etc/splunk-launch.conf splunk_os_user":
          lens    => 'ShellVars.lns',
          incl    => "${splunk_home}/etc/splunk-launch.conf",
          changes => [
            "set SPLUNK_OS_USER ${splunk_os_user}",
          ];
        }
      }
      if $splunk_bindip == undef {
        augeas { "${splunk_home}/etc/splunk-launch.conf splunk_bindip":
          lens    => 'ShellVars.lns',
          incl    => "${splunk_home}/etc/splunk-launch.conf",
          changes => [
            'rm SPLUNK_BINDIP',
          ];
        }
      } else {
        augeas { "${splunk_home}/etc/splunk-launch.conf splunk_bindip":
          lens    => 'ShellVars.lns',
          incl    => "${splunk_home}/etc/splunk-launch.conf",
          changes => [
            "set SPLUNK_BINDIP ${splunk_bindip}",
          ];
        }
      }
      if $splunk_db == undef {
        #For now, we skip removing SPLUNK_DB if unset, because people may have previously set this manually.
        #Perhaps we'll start removing SPLUNK_DB in a 4.x release
        #augeas { "${splunk_home}/etc/splunk-launch.conf splunk_db":
        #  lens    => 'ShellVars.lns',
        #  incl    => "${splunk_home}/etc/splunk-launch.conf",
        #  changes => [
        #    'rm SPLUNK_DB',
        #  ];
        #}
      } else {
        augeas { "${splunk_home}/etc/splunk-launch.conf splunk_db":
          lens    => 'ShellVars.lns',
          incl    => "${splunk_home}/etc/splunk-launch.conf",
          changes => [
            "set SPLUNK_DB ${splunk_db}",
          ];
        }
      }
    }
  }
}