Upgrade to 3rdparty version 0.9.4 of elasticsearch/elasticsearch
[mirror/dsa-puppet.git] / 3rdparty / modules / elasticsearch / manifests / service.pp
1 # == Class: elasticsearch::service
2 #
3 # This class exists to coordinate all service management related actions,
4 # functionality and logical units in a central place.
5 #
6 # <b>Note:</b> "service" is the Puppet term and type for background processes
7 # in general and is used in a platform-independent way. E.g. "service" means
8 # "daemon" in relation to Unix-like systems.
9 #
10 #
11 # === Parameters
12 #
13 # [*ensure*]
14 #   String. Controls if the managed resources shall be <tt>present</tt> or
15 #   <tt>absent</tt>. If set to <tt>absent</tt>:
16 #   * The managed software packages are being uninstalled.
17 #   * Any traces of the packages will be purged as good as possible. This may
18 #     include existing configuration files. The exact behavior is provider
19 #     dependent. Q.v.:
20 #     * Puppet type reference: {package, "purgeable"}[http://j.mp/xbxmNP]
21 #     * {Puppet's package provider source code}[http://j.mp/wtVCaL]
22 #   * System modifications (if any) will be reverted as good as possible
23 #     (e.g. removal of created users, services, changed log settings, ...).
24 #   * This is thus destructive and should be used with care.
25 #   Defaults to <tt>present</tt>.
26 #
27 # [*status*]
28 #   String to define the status of the service. Possible values:
29 #   * <tt>enabled</tt>: Service is running and will be started at boot time.
30 #   * <tt>disabled</tt>: Service is stopped and will not be started at boot
31 #     time.
32 #   * <tt>running</tt>: Service is running but will not be started at boot time.
33 #     You can use this to start a service on the first Puppet run instead of
34 #     the system startup.
35 #   * <tt>unmanaged</tt>: Service will not be started at boot time and Puppet
36 #     does not care whether the service is running or not. For example, this may
37 #     be useful if a cluster management software is used to decide when to start
38 #     the service plus assuring it is running on the desired node.
39 #   Defaults to <tt>enabled</tt>. The singular form ("service") is used for the
40 #   sake of convenience. Of course, the defined status affects all services if
41 #   more than one is managed (see <tt>service.pp</tt> to check if this is the
42 #   case).
43 #
44 # [*init_defaults*]
45 #   Defaults file content in hash representation
46 #
47 # [*init_defaults_file*]
48 #   Defaults file as puppet resource
49 #
50 # [*init_template*]
51 #   Service file as a template
52 #
53 # === Authors
54 #
55 # * Richard Pijnenburg <mailto:richard.pijnenburg@elasticsearch.com>
56 #
57 define elasticsearch::service(
58   $ensure             = $elasticsearch::ensure,
59   $status             = $elasticsearch::status,
60   $init_defaults_file = undef,
61   $init_defaults      = undef,
62   $init_template      = undef,
63 ) {
64
65   case $elasticsearch::real_service_provider {
66
67     'init': {
68       elasticsearch::service::init { $name:
69         ensure             => $ensure,
70         status             => $status,
71         init_defaults_file => $init_defaults_file,
72         init_defaults      => $init_defaults,
73         init_template      => $init_template,
74       }
75     }
76     'systemd': {
77       elasticsearch::service::systemd { $name:
78         ensure             => $ensure,
79         status             => $status,
80         init_defaults_file => $init_defaults_file,
81         init_defaults      => $init_defaults,
82         init_template      => $init_template,
83       }
84     }
85     default: {
86       fail("Unknown service provider ${elasticsearch::real_service_provider}")
87     }
88
89   }
90
91 }