]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/elasticsearch/manifests/params.pp
upgrade to elasticsearch/elasticsearch 0.9.6
[dsa-puppet.git] / 3rdparty / modules / elasticsearch / manifests / params.pp
1 # == Class: elasticsearch::params
2 #
3 # This class exists to
4 # 1. Declutter the default value assignment for class parameters.
5 # 2. Manage internally used module variables in a central place.
6 #
7 # Therefore, many operating system dependent differences (names, paths, ...)
8 # are addressed in here.
9 #
10 #
11 # === Parameters
12 #
13 # This class does not provide any parameters.
14 #
15 #
16 # === Examples
17 #
18 # This class is not intended to be used directly.
19 #
20 #
21 # === Links
22 #
23 # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY]
24 #
25 #
26 # === Authors
27 #
28 # * Richard Pijnenburg <mailto:richard@ispavailability.com>
29 #
30 class elasticsearch::params {
31
32   #### Default values for the parameters of the main module class, init.pp
33
34   # ensure
35   $ensure = 'present'
36
37   # autoupgrade
38   $autoupgrade = false
39
40   # service status
41   $status = 'enabled'
42
43   # restart on configuration change?
44   $restart_on_change = true
45
46   # Purge configuration directory
47   $purge_configdir = false
48
49   $purge_package_dir = false
50
51   # package download timeout
52   $package_dl_timeout = 600 # 300 seconds is default of puppet
53
54   $default_logging_level = 'INFO'
55
56   $logging_defaults = {
57     'action'                 => 'DEBUG',
58     'com.amazonaws'          => 'WARN',
59     'index.search.slowlog'   => 'TRACE, index_search_slow_log_file',
60     'index.indexing.slowlog' => 'TRACE, index_indexing_slow_log_file',
61   }
62
63   #### Internal module values
64
65   # User and Group for the files and user to run the service as.
66   case $::kernel {
67     'Linux': {
68       $elasticsearch_user  = 'elasticsearch'
69       $elasticsearch_group = 'elasticsearch'
70     }
71     'Darwin': {
72       $elasticsearch_user  = 'elasticsearch'
73       $elasticsearch_group = 'elasticsearch'
74     }
75     default: {
76       fail("\"${module_name}\" provides no user/group default value
77            for \"${::kernel}\"")
78     }
79   }
80
81   # Download tool
82
83   case $::kernel {
84     'Linux': {
85       $download_tool = 'wget --no-check-certificate -O'
86     }
87     'Darwin': {
88       $download_tool = 'curl --insecure -o'
89     }
90     default: {
91       fail("\"${module_name}\" provides no download tool default value
92            for \"${::kernel}\"")
93     }
94   }
95
96   # Different path definitions
97   case $::kernel {
98     'Linux': {
99       $configdir   = '/etc/elasticsearch'
100       $logdir      = '/var/log/elasticsearch'
101       $package_dir = '/opt/elasticsearch/swdl'
102       $installpath = '/opt/elasticsearch'
103       $homedir     = '/usr/share/elasticsearch'
104       $plugindir   = "${homedir}/plugins"
105       $plugintool  = "${homedir}/bin/plugin"
106       $datadir     = '/usr/share/elasticsearch/data'
107     }
108     default: {
109       fail("\"${module_name}\" provides no config directory default value
110            for \"${::kernel}\"")
111     }
112   }
113
114   # packages
115   case $::operatingsystem {
116     'RedHat', 'CentOS', 'Fedora', 'Scientific', 'Amazon', 'OracleLinux', 'SLC': {
117       # main application
118       $package = [ 'elasticsearch' ]
119     }
120     'Debian', 'Ubuntu': {
121       # main application
122       $package = [ 'elasticsearch' ]
123     }
124     'OpenSuSE': {
125       $package = [ 'elasticsearch' ]
126     }
127     default: {
128       fail("\"${module_name}\" provides no package default value
129             for \"${::operatingsystem}\"")
130     }
131   }
132
133   # service parameters
134   case $::operatingsystem {
135     'RedHat', 'CentOS', 'Fedora', 'Scientific', 'Amazon', 'OracleLinux', 'SLC': {
136       $service_name       = 'elasticsearch'
137       $service_hasrestart = true
138       $service_hasstatus  = true
139       $service_pattern    = $service_name
140       $defaults_location  = '/etc/sysconfig'
141       $pid_dir            = '/var/run/elasticsearch'
142
143       if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
144         $init_template     = 'elasticsearch.systemd.erb'
145         $service_providers = 'systemd'
146       } else {
147         $init_template     = 'elasticsearch.RedHat.erb'
148         $service_providers = 'init'
149       }
150
151     }
152     'Debian': {
153       $service_name       = 'elasticsearch'
154       $service_hasrestart = true
155       $service_hasstatus  = true
156       $service_pattern    = $service_name
157       $defaults_location  = '/etc/default'
158       if versioncmp($::operatingsystemmajrelease, '8') >= 0 {
159         $init_template     = 'elasticsearch.systemd.erb'
160         $service_providers = 'systemd'
161         $pid_dir           = '/var/run/elasticsearch'
162       } else {
163         $init_template     = 'elasticsearch.Debian.erb'
164         $service_providers = [ 'init' ]
165         $pid_dir           = false
166       }
167     }
168     'Ubuntu': {
169       $service_name       = 'elasticsearch'
170       $service_hasrestart = true
171       $service_hasstatus  = true
172       $service_pattern    = $service_name
173       $defaults_location  = '/etc/default'
174
175       if versioncmp($::operatingsystemmajrelease, '15') >= 0 {
176         $init_template     = 'elasticsearch.systemd.erb'
177         $service_providers = 'systemd'
178         $pid_dir           = '/var/run/elasticsearch'
179       } else {
180         $init_template     = 'elasticsearch.Debian.erb'
181         $service_providers = [ 'init' ]
182         $pid_dir           = false
183       }
184     }
185     'Darwin': {
186       $service_name       = 'FIXME/TODO'
187       $service_hasrestart = true
188       $service_hasstatus  = true
189       $service_pattern    = $service_name
190       $service_providers  = 'launchd'
191       $defaults_location  = false
192       $pid_dir            = false
193     }
194     'OpenSuSE': {
195       $service_name       = 'elasticsearch'
196       $service_hasrestart = true
197       $service_hasstatus  = true
198       $service_pattern    = $service_name
199       $service_providers  = 'systemd'
200       $defaults_location  = '/etc/sysconfig'
201       $init_template      = 'elasticsearch.systemd.erb'
202       $pid_dir            = '/var/run/elasticsearch'
203     }
204     default: {
205       fail("\"${module_name}\" provides no service parameters
206             for \"${::operatingsystem}\"")
207     }
208   }
209
210 }