Puppet Class: splunk::installed

Defined in:
manifests/installed.pp

Overview

Parameters:

  • package (Any) (defaults to: $splunk::package)
  • package_source (Any) (defaults to: $splunk::package_source)
  • splunk_home (Any) (defaults to: $splunk::splunk_home)
  • splunk_os_user (Any) (defaults to: $splunk::real_splunk_os_user)
  • version (Any) (defaults to: $splunk::version)


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
75
76
77
78
79
80
81
82
83
84
# File 'manifests/installed.pp', line 6

class splunk::installed (
  $package = $splunk::package,
  $package_source = $splunk::package_source,
  $splunk_home = $splunk::splunk_home,
  $splunk_os_user = $splunk::real_splunk_os_user,
  $version = $splunk::version
) {
  case $::osfamily {
    /^[Ww]indows$/: {
      if $package_source == undef {
        fail('package_source variable is required for Windows installations')
      }
      package { $package:
        ensure          => installed,
        source          => $package_source,
        install_options => ['AGREETOLICENSE=Yes','LAUNCHSPLUNK=0','/quiet'],
      }
    }
    default: {
      if $version == undef and $package_source == undef {
        package { $package:
          ensure => installed,
        }
        -> exec { 'splunk initial run':
          command => "${splunk_home}/bin/splunk version --accept-license --answer-yes --no-prompt",
          path    => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require => Package[$package],
          user    => $splunk_os_user,
          creates => "${splunk_home}/etc/system/local/server.conf",
          notify  => Exec['splunk enable boot-start'],
        }
        -> exec { 'splunk enable boot-start':
          command     => "${splunk_home}/bin/splunk enable boot-start -user ${splunk_os_user} --accept-license --answer-yes --no-prompt",
          path        => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require     => Package[$package],
          refreshonly => true,
        }
      } elsif $version == undef and $package_source != undef {
        package { $package:
          ensure => installed,
          name   => $package_source,
        }
        -> exec { 'splunk initial run':
          command => "${splunk_home}/bin/splunk version --accept-license --answer-yes --no-prompt",
          path    => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require => Package[$package],
          user    => $splunk_os_user,
          creates => "${splunk_home}/etc/system/local/server.conf",
          notify  => Exec['splunk enable boot-start'],
        }
        -> exec { 'splunk enable boot-start':
          command     => "${splunk_home}/bin/splunk enable boot-start -user ${splunk_os_user} --accept-license --answer-yes --no-prompt",
          path        => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require     => Package[$package],
          refreshonly => true,
        }
      } else {
        package { $package:
          ensure => $version,
        }
        -> exec { 'splunk initial run':
          command => "${splunk_home}/bin/splunk version --accept-license --answer-yes --no-prompt",
          path    => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require => Package[$package],
          user    => $splunk_os_user,
          creates => "${splunk_home}/etc/system/local/server.conf",
          notify  => Exec['splunk enable boot-start'],
        }
        -> exec { 'splunk enable boot-start':
          command     => "${splunk_home}/bin/splunk enable boot-start -user ${splunk_os_user} --accept-license --answer-yes --no-prompt",
          path        => ["${splunk_home}/bin", '/bin', '/sbin', '/usr/bin', '/usr/sbin'],
          require     => Package[$package],
          refreshonly => true,
        }
      }
    }
  }

}