Puppet Class: mosquitto::service

Defined in:
manifests/service.pp

Summary

handles the Mosquitto service

Overview

Parameters:

  • manage_service (Boolean) (defaults to: $mosquitto::manage_service)
  • ensure (Stdlib::Ensure::Service) (defaults to: $mosquitto::service_ensure)
  • enable (Boolean) (defaults to: $mosquitto::service_enable)
  • service_name (String[1]) (defaults to: $mosquitto::service_name)

Author:

  • Tim Meusel <tim@bastelfreak.de>



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'manifests/service.pp', line 8

class mosquitto::service (
  Boolean $manage_service = $mosquitto::manage_service,
  Stdlib::Ensure::Service $ensure = $mosquitto::service_ensure,
  Boolean $enable = $mosquitto::service_enable,
  String[1] $service_name = $mosquitto::service_name,
) {
  assert_private()

  if $manage_service {
    service { 'mosquitto':
      ensure => $ensure,
      name   => $service_name,
      enable => $enable,
    }

    if $facts['systemd'] {
      # patch the unit file to ensure mosquitto starts after the network is up
      $content = @(EOT)
        # THIS FILE IS MANAGED BY PUPPET
        [Unit]
        Requires=network-online.target
        After=network-online.target
        | EOT

      systemd::dropin_file { 'mosquitto-override.conf':
        ensure         => bool2str($ensure == 'running', 'present', 'absent'),
        unit           => 'mosquitto.service',
        content        => $content,
        notify_service => true,
      }
    }
  }
}