1 # == Class: elasticsearch::service
3 # This class exists to coordinate all service management related actions,
4 # functionality and logical units in a central place.
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.
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
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>.
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
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
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
45 # Defaults file content in hash representation
47 # [*init_defaults_file*]
48 # Defaults file as puppet resource
51 # Service file as a template
55 # * Richard Pijnenburg <mailto:richard.pijnenburg@elasticsearch.com>
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,
65 case $elasticsearch::real_service_provider {
68 elasticsearch::service::init { $name:
71 init_defaults_file => $init_defaults_file,
72 init_defaults => $init_defaults,
73 init_template => $init_template,
77 elasticsearch::service::systemd { $name:
80 init_defaults_file => $init_defaults_file,
81 init_defaults => $init_defaults,
82 init_template => $init_template,
86 fail("Unknown service provider ${elasticsearch::real_service_provider}")