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

reload_fpm_on_config_changes

by default, we reload the service on changes. But certain options, like socket owner, will only be applied during a restart. If set to false, a restart will be executed instead of a reload. This default will be changed in a future release.

Parameters:

  • service_name (String[1]) (defaults to: $php::fpm::service_name)
  • ensure (Enum['running', 'stopped']) (defaults to: $php::fpm::service_ensure)
  • enable (Boolean) (defaults to: $php::fpm::service_enable)
  • provider (Optional[String[1]]) (defaults to: $php::fpm::service_provider)
  • reload_fpm_on_config_changes (Boolean) (defaults to: $php::fpm::reload_fpm_on_config_changes)


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
51
52
# File 'manifests/fpm/service.pp', line 23

class php::fpm::service (
  String[1] $service_name               = $php::fpm::service_name,
  Enum['running', 'stopped'] $ensure    = $php::fpm::service_ensure,
  Boolean $enable                       = $php::fpm::service_enable,
  Optional[String[1]] $provider         = $php::fpm::service_provider,
  Boolean $reload_fpm_on_config_changes = $php::fpm::reload_fpm_on_config_changes,
) {
  if ! defined(Class['php::fpm']) {
    warning('php::fpm::service is private')
  }

  if $reload_fpm_on_config_changes {
    $restart = $facts['service_provider'] ? {
      'systemd' => "systemctl reload ${service_name}",
      default   => "service ${service_name} reload"
    }
  } else {
    $restart = undef
  }
  service { $service_name:
    ensure     => $ensure,
    enable     => $enable,
    provider   => $provider,
    hasrestart => true,
    restart    => $restart,
    hasstatus  => true,
  }

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