|
28
|
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', '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 |
'Amazon': { |
|
|
153 |
$service_name = 'elasticsearch' |
|
|
154 |
$service_hasrestart = true |
|
|
155 |
$service_hasstatus = true |
|
|
156 |
$service_pattern = $service_name |
|
|
157 |
$defaults_location = '/etc/sysconfig' |
|
|
158 |
$pid_dir = '/var/run/elasticsearch' |
|
|
159 |
$init_template = 'elasticsearch.RedHat.erb' |
|
|
160 |
$service_providers = 'init' |
|
|
161 |
} |
|
|
162 |
'Debian': { |
|
|
163 |
$service_name = 'elasticsearch' |
|
|
164 |
$service_hasrestart = true |
|
|
165 |
$service_hasstatus = true |
|
|
166 |
$service_pattern = $service_name |
|
|
167 |
$defaults_location = '/etc/default' |
|
|
168 |
if versioncmp($::operatingsystemmajrelease, '8') >= 0 { |
|
|
169 |
$init_template = 'elasticsearch.systemd.erb' |
|
|
170 |
$service_providers = 'systemd' |
|
|
171 |
$pid_dir = '/var/run/elasticsearch' |
|
|
172 |
} else { |
|
|
173 |
$init_template = 'elasticsearch.Debian.erb' |
|
|
174 |
$service_providers = [ 'init' ] |
|
|
175 |
$pid_dir = false |
|
|
176 |
} |
|
|
177 |
} |
|
|
178 |
'Ubuntu': { |
|
|
179 |
$service_name = 'elasticsearch' |
|
|
180 |
$service_hasrestart = true |
|
|
181 |
$service_hasstatus = true |
|
|
182 |
$service_pattern = $service_name |
|
|
183 |
$defaults_location = '/etc/default' |
|
|
184 |
|
|
|
185 |
if versioncmp($::operatingsystemmajrelease, '15') >= 0 { |
|
|
186 |
$init_template = 'elasticsearch.systemd.erb' |
|
|
187 |
$service_providers = 'systemd' |
|
|
188 |
$pid_dir = '/var/run/elasticsearch' |
|
|
189 |
} else { |
|
|
190 |
$init_template = 'elasticsearch.Debian.erb' |
|
|
191 |
$service_providers = [ 'init' ] |
|
|
192 |
$pid_dir = false |
|
|
193 |
} |
|
|
194 |
} |
|
|
195 |
'Darwin': { |
|
|
196 |
$service_name = 'FIXME/TODO' |
|
|
197 |
$service_hasrestart = true |
|
|
198 |
$service_hasstatus = true |
|
|
199 |
$service_pattern = $service_name |
|
|
200 |
$service_providers = 'launchd' |
|
|
201 |
$defaults_location = false |
|
|
202 |
$pid_dir = false |
|
|
203 |
} |
|
|
204 |
'OpenSuSE': { |
|
|
205 |
$service_name = 'elasticsearch' |
|
|
206 |
$service_hasrestart = true |
|
|
207 |
$service_hasstatus = true |
|
|
208 |
$service_pattern = $service_name |
|
|
209 |
$service_providers = 'systemd' |
|
|
210 |
$defaults_location = '/etc/sysconfig' |
|
|
211 |
$init_template = 'elasticsearch.systemd.erb' |
|
|
212 |
$pid_dir = '/var/run/elasticsearch' |
|
|
213 |
} |
|
|
214 |
default: { |
|
|
215 |
fail("\"${module_name}\" provides no service parameters |
|
|
216 |
for \"${::operatingsystem}\"") |
|
|
217 |
} |
|
|
218 |
} |
|
|
219 |
|
|
|
220 |
} |