Puppet Class: nginx::service

Defined in:
manifests/service.pp

Summary

Manage NGINX service management

Overview



5
6
7
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 5

class nginx::service {
  assert_private()

  if $nginx::service_config_check {
    exec { 'nginx_config_check':
      command     => $nginx::service_config_check_command,
      refreshonly => true,
      path        => [
        '/usr/local/sbin',
        '/usr/local/bin',
        '/usr/sbin',
        '/usr/bin',
        '/sbin',
        '/bin',
      ],
    }

    File <| tag == 'nginx_config_file' |> ~> Exec['nginx_config_check']
    Concat <| tag == 'nginx_config_file' |> ~> Exec['nginx_config_check']
  }

  if $nginx::service_manage {
    $service_require = $nginx::service_config_check ? {
      true  => Exec['nginx_config_check'],
      false => undef,
    }

    service { $nginx::service_name:
      ensure  => $nginx::service_ensure,
      enable  => $nginx::service_enable,
      flags   => $nginx::service_flags,
      restart => $nginx::service_restart,
      require => $service_require,
    }
  }
}