Puppet Class: logstash::service

Defined in:
manifests/service.pp

Overview

Class: logstash::service

This class exists to coordinate all service management related actions, functionality and logical units in a central place.

Note: “service” is the Puppet term and type for background processes in general and is used in a platform-independent way. E.g. “service” means “daemon” in relation to Unix-like systems.

Parameters

This class does not provide any parameters.

Examples

This class may be imported by other classes to use its functionality:

class { 'logstash::service': }

It is not intended to be used directly by external resources like node definitions or other modules.

Authors



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
# File 'manifests/service.pp', line 29

class logstash::service {

  #### Service management

  # set params: in operation
  if $logstash::ensure == 'present' {

    case $logstash::status {
      # make sure service is currently running, start it on boot
      'enabled': {
        $service_ensure = 'running'
        $service_enable = true
      }
      # make sure service is currently stopped, do not start it on boot
      'disabled': {
        $service_ensure = 'stopped'
        $service_enable = false
      }
      # make sure service is currently running, do not start it on boot
      'running': {
        $service_ensure = 'running'
        $service_enable = false
      }
      # do not start service on boot, do not care whether currently running or not
      'unmanaged': {
        $service_ensure = undef
        $service_enable = false
      }
      # unknown status
      # note: don't forget to update the parameter check in init.pp if you
      #       add a new or change an existing status.
      default: {
        fail("\"${logstash::status}\" is an unknown service status value")
      }
    }

  # set params: removal
  } else {

    # make sure the service is stopped and disabled (the removal itself will be
    # done by package.pp)
    $service_ensure = 'stopped'
    $service_enable = false

  }

  # Remove the init file and service from the package if we install it via a package
  if $logstash::provider == 'package' {

    service { 'logstash':
      ensure => 'stopped',
      enable => false
    }

  }

  # Only not managed the init file when we are using an external jar file and use an other service manager
  # TODO: This is an ugly hack for now because i can't think up a better solution.
  if ($logstash::jarfile != undef and $logstash::status == 'unmanaged') {
    # Don't manage the service
  } else {
    logstash::servicefile { $logstash::instances:
      service_enable => $service_enable,
      service_ensure => $service_ensure
    }
  }

}