Puppet Class: simp_apache::service

Defined in:
manifests/service.pp

Overview

Control the Apache service

Parameters:

  • manage (Boolean) (defaults to: true)

    Whether or not to manage the service

    If set to ‘false`, you may need to add the service name to `svckill::ignore` if you are in enforcing mode.

  • service_name (String[1]) (defaults to: 'httpd')

    The name of the service to manage

  • ensure (String[1]) (defaults to: 'running')

    The state that the service should be in

  • enable (Boolean) (defaults to: true)

    Whether or not to enable the daemon

  • hasstatus (Boolean) (defaults to: true)

    Whether or not the service has a ‘status’ command

  • hasrestart (Boolean) (defaults to: false)

    If set to ‘true` then the contents of `$restart` will be ignored

  • restart (String[1]) (defaults to: '/usr/bin/systemctl reload httpd.service || /usr/bin/systemctl restart httpd.service')

    A specific command to use to restart the daemon

    • Ignored if ‘$hasrestart` is set to `true`

    • The ‘reload || restart` is in place to try to force a clean restart if a reload fails to do the job.



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

class simp_apache::service (
  Boolean   $manage       = true,
  String[1] $service_name = 'httpd',
  String[1] $ensure       = 'running',
  Boolean   $enable       = true,
  Boolean   $hasstatus    = true,
  Boolean   $hasrestart   = false,
  String[1] $restart      = '/usr/bin/systemctl reload httpd.service || /usr/bin/systemctl restart httpd.service'
) {
  if $manage {
    if $hasrestart {
      $_restart = undef
    }
    else {
      $_restart = $restart
    }

    service { $service_name:
      ensure     => $ensure,
      enable     => $enable,
      hasrestart => $hasrestart,
      hasstatus  => $hasstatus,
      restart    => $_restart
    }
  }
}