# Puppet Class: php::fpm::service

Defined in:
  manifests/fpm/service.pp

## Overview

Manage fpm service

=== Parameters

[service_name] name of the php-fpm service

[ensure] 'ensure' value for the service

[enable] Defines if the service is enabled

[provider] Defines if the service provider to use

Parameters:

- service_name (`Any`) (defaults to: `$::php::fpm::service_name`)
- ensure (`Any`) (defaults to: `$::php::fpm::service_ensure`)
- enable (`Any`) (defaults to: `$::php::fpm::service_enable`)
- provider (`Any`) (defaults to: `$::php::fpm::service_provider`)

    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    # File 'manifests/fpm/service.pp', line 17

    class php::fpm::service(
      $service_name = $::php::fpm::service_name,
      $ensure       = $::php::fpm::service_ensure,
      $enable       = $::php::fpm::service_enable,
      $provider     = $::php::fpm::service_provider,
    ) {

      if ! defined(Class['php::fpm']) {
        warning('php::fpm::service is private')
      }

      $reload = "service ${service_name} reload"

      if ($facts['os']['name'] == 'Ubuntu'
          and versioncmp($facts['os']['release']['full'], '12') >= 0
          and versioncmp($facts['os']['release']['full'], '14') < 0) {
        # Precise upstart doesn't support reload signals, so use
        # regular service restart instead
        $restart = undef
      } else {
        $restart = $reload
      }

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

      ::Php::Extension <| |> ~> Service[$service_name]
    }