Puppet Class: elasticsearch::params
- Inherited by:
-
elasticsearch
- Defined in:
- manifests/params.pp
Summary
Provides operating system-specific defaults for init.ppOverview
This class exists to:
-
Declutter the default value assignment for class parameters.
-
Manage internally used module variables in a central place.
Therefore, many operating system dependent differences (names, paths, …) are addressed in here.
See the Puppet docs on using parameterized Classes for more information.
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'manifests/params.pp', line 19
class elasticsearch::params {
$restart_on_change = false
$logging_defaults = {
'action' => 'DEBUG',
'com.amazonaws' => 'WARN',
'index.search.slowlog' => 'TRACE, index_search_slow_log_file',
'index.indexing.slowlog' => 'TRACE, index_indexing_slow_log_file',
}
#### Internal module values
# User and Group for the files and user to run the service as.
case $::kernel {
'Linux': {
$elasticsearch_user = 'elasticsearch'
$elasticsearch_group = 'elasticsearch'
}
'Darwin': {
$elasticsearch_user = 'elasticsearch'
$elasticsearch_group = 'elasticsearch'
}
'OpenBSD': {
$elasticsearch_user = '_elasticsearch'
$elasticsearch_group = '_elasticsearch'
}
default: {
fail("\"${module_name}\" provides no user/group default value
for \"${::kernel}\"")
}
}
# Download tool
case $::kernel {
'Linux': {
$download_tool = 'wget --no-check-certificate -O'
}
'Darwin': {
$download_tool = 'curl --insecure -o'
}
'OpenBSD': {
$download_tool = 'ftp -o'
}
default: {
fail("\"${module_name}\" provides no download tool default value
for \"${::kernel}\"")
}
}
# Different path definitions
case $::kernel {
'Linux': {
$configdir = '/etc/elasticsearch'
$package_dir = '/opt/elasticsearch/swdl'
$installpath = '/opt/elasticsearch'
$homedir = '/usr/share/elasticsearch'
$plugindir = "${homedir}/plugins"
$datadir = '/var/lib/elasticsearch'
}
'OpenBSD': {
$configdir = '/etc/elasticsearch'
$package_dir = '/var/cache/elasticsearch'
$installpath = undef
$homedir = '/usr/local/elasticsearch'
$plugindir = "${homedir}/plugins"
$datadir = '/var/elasticsearch/data'
}
default: {
fail("\"${module_name}\" provides no config directory default value
for \"${::kernel}\"")
}
}
# packages
case $::operatingsystem {
'RedHat', 'CentOS', 'Fedora', 'Scientific', 'Amazon', 'OracleLinux', 'SLC',
'Debian', 'Ubuntu', 'OpenSuSE', 'SLES', 'OpenBSD': {
$package = 'elasticsearch'
}
'Gentoo': {
$package = 'app-misc/elasticsearch'
}
default: {
fail("\"${module_name}\" provides no package default value
for \"${::operatingsystem}\"")
}
}
# service parameters
case $::operatingsystem {
'RedHat', 'CentOS', 'Fedora', 'Scientific', 'OracleLinux', 'SLC': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$defaults_location = '/etc/sysconfig'
$pid_dir = '/var/run/elasticsearch'
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
$init_template = 'elasticsearch.systemd.erb'
$service_providers = 'systemd'
$systemd_service_path = '/lib/systemd/system'
} else {
$init_template = 'elasticsearch.RedHat.erb'
$service_providers = 'init'
$systemd_service_path = undef
}
}
'Amazon': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$defaults_location = '/etc/sysconfig'
$pid_dir = '/var/run/elasticsearch'
$init_template = 'elasticsearch.RedHat.erb'
$service_providers = 'init'
$systemd_service_path = undef
}
'Debian': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$defaults_location = '/etc/default'
if versioncmp($::operatingsystemmajrelease, '8') >= 0 {
$init_template = 'elasticsearch.systemd.erb'
$service_providers = 'systemd'
$systemd_service_path = '/lib/systemd/system'
$pid_dir = '/var/run/elasticsearch'
} else {
$init_template = 'elasticsearch.Debian.erb'
$pid_dir = false
$service_providers = [ 'init' ]
$systemd_service_path = undef
}
}
'Ubuntu': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$defaults_location = '/etc/default'
if versioncmp($::operatingsystemmajrelease, '15') >= 0 {
$init_template = 'elasticsearch.systemd.erb'
$service_providers = 'systemd'
$systemd_service_path = '/lib/systemd/system'
$pid_dir = '/var/run/elasticsearch'
} else {
$init_template = 'elasticsearch.Debian.erb'
$pid_dir = false
$service_providers = [ 'init' ]
$systemd_service_path = undef
}
}
'Darwin': {
$service_name = 'FIXME/TODO'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$service_providers = 'launchd'
$systemd_service_path = undef
$defaults_location = false
$pid_dir = false
}
'OpenSuSE': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$service_providers = 'systemd'
$defaults_location = '/etc/sysconfig'
$init_template = 'elasticsearch.systemd.erb'
$pid_dir = '/var/run/elasticsearch'
if versioncmp($::operatingsystemmajrelease, '12') <= 0 {
$systemd_service_path = '/lib/systemd/system'
} else {
$systemd_service_path = '/usr/lib/systemd/system'
}
}
'SLES': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$defaults_location = '/etc/sysconfig'
if versioncmp($::operatingsystemmajrelease, '12') >= 0 {
$init_template = 'elasticsearch.systemd.erb'
$service_providers = 'systemd'
$systemd_service_path = '/usr/lib/systemd/system'
$pid_dir = '/var/run/elasticsearch'
} else {
$init_template = 'elasticsearch.SLES.erb'
$service_providers = [ 'init' ]
$systemd_service_path = undef
$pid_dir = false
}
}
'Gentoo': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = $service_name
$service_providers = 'openrc'
$systemd_service_path = undef
$defaults_location = '/etc/conf.d'
$init_template = 'elasticsearch.openrc.erb'
$pid_dir = '/run/elasticsearch'
}
'OpenBSD': {
$service_name = 'elasticsearch'
$service_hasrestart = true
$service_hasstatus = true
$service_pattern = undef
$service_providers = 'openbsd'
$systemd_service_path = undef
$defaults_location = undef
$init_template = 'elasticsearch.OpenBSD.erb'
$pid_dir = '/var/run/elasticsearch'
}
default: {
fail("\"${module_name}\" provides no service parameters
for \"${::operatingsystem}\"")
}
}
}
|