]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/elasticsearch/manifests/params.pp
8b137bb414affa3511a64ba8e193cfa2a6fee101
[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
137       case $::operatingsystemmajrelease {
138         '7': {
139           $init_template     = 'elasticsearch.systemd.erb'
140           $service_providers = 'systemd'
141         }
142         default: {
143           $init_template     = 'elasticsearch.RedHat.erb'
144           $service_providers = [ 'init' ]
145         }
146       }
147
148       $service_name       = 'elasticsearch'
149       $service_hasrestart = true
150       $service_hasstatus  = true
151       $service_pattern    = $service_name
152       $defaults_location  = '/etc/sysconfig'
153       $pid_dir            = '/var/run/elasticsearch'
154     }
155     'Debian', 'Ubuntu': {
156       $service_name       = 'elasticsearch'
157       $service_hasrestart = true
158       $service_hasstatus  = true
159       $service_pattern    = $service_name
160       $service_providers  = 'init'
161       $defaults_location  = '/etc/default'
162       $init_template      = 'elasticsearch.Debian.erb'
163       $pid_dir            = false
164     }
165     'Darwin': {
166       $service_name       = 'FIXME/TODO'
167       $service_hasrestart = true
168       $service_hasstatus  = true
169       $service_pattern    = $service_name
170       $service_providers  = 'launchd'
171       $defaults_location  = false
172       $pid_dir            = false
173     }
174     'OpenSuSE': {
175       $service_name       = 'elasticsearch'
176       $service_hasrestart = true
177       $service_hasstatus  = true
178       $service_pattern    = $service_name
179       $service_providers  = 'systemd'
180       $defaults_location  = '/etc/sysconfig'
181       $init_template      = 'elasticsearch.systemd.erb'
182       $pid_dir            = '/var/run/elasticsearch'
183     }
184     default: {
185       fail("\"${module_name}\" provides no service parameters
186             for \"${::operatingsystem}\"")
187     }
188   }
189
190 }