init.pp 1.34 KB
Newer Older
mh's avatar
mh committed
1
# manage nginx stuff
2
# Copyright (C) 2007 admin@immerda.ch
mh's avatar
mh committed
3
# GPLv3
mh's avatar
mh committed
4
5
6
7
8
9
#
#  Parameters:
#
#    * manage_shorewall_http:  Open http port with shorewall?
#    * manage_shorewall_https: Open https port with shorewall?
#
10
class nginx (
11
12
13
14
15
  $custom_config = false,
  $access_log             = "distribution",
  $error_log              = "distribution",
  $ensure                 = running,
  $enable                 = true,
mh's avatar
mh committed
16
17
  $manage_shorewall_http  = false,
  $manage_shorewall_https = false,
mh's avatar
mh committed
18
  $use_munin              = false,
mh's avatar
mh committed
19
20
  $vhosts                 = {},
  $confs                  = {},
mh's avatar
mh committed
21
) {
22

23
24
25
26
27
28
29
  # Validate some parameters.
  case $access_log {
    'distribution',
    'noip',
    'none':  {}
    default: {
      fail('The access_log parameter can only be one of: distribution, noip, none')
30
    }
31
32
33
34
35
36
  }
  case $error_log {
    'distribution',
    'none':  {}
    default: {
      fail('The error_log parameter can only be one of: distribution, none')
intrigeri's avatar
intrigeri committed
37
    }
38
39
  }

mh's avatar
mh committed
40
  include ::nginx::base
mh's avatar
mh committed
41
42

  if $manage_shorewall_http {
mh's avatar
mh committed
43
    include ::shorewall::rules::http
mh's avatar
mh committed
44
45
  }
  if $manage_shorewall_https {
mh's avatar
mh committed
46
    include ::shorewall::rules::https
mh's avatar
mh committed
47
  }
mh's avatar
mh committed
48
49

  if $use_munin {
mh's avatar
mh committed
50
    include ::nginx::munin
mh's avatar
mh committed
51
  } else {
mh's avatar
mh committed
52
    include ::nginx::munin::disable
mh's avatar
mh committed
53
  }
mh's avatar
mh committed
54
55

  if str2bool($::selinux) {
mh's avatar
mh committed
56
    include ::nginx::selinux
mh's avatar
mh committed
57
  }
58

mh's avatar
mh committed
59
60
  create_resources('nginx::vhostsd',$vhosts)
  create_resources('nginx::confd',$confs)
mh's avatar
mh committed
61
}