Puppet Class: apache::default_mods

Defined in:
manifests/default_mods.pp

Summary

Installs and congfigures default mods for Apache

Overview

Parameters:

  • all (Any) (defaults to: true)
  • mods (Any) (defaults to: undef)
  • apache_version (Any) (defaults to: $::apache::apache_version)
  • use_systemd (Any) (defaults to: $::apache::use_systemd)


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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'manifests/default_mods.pp', line 5

class apache::default_mods (
  $all            = true,
  $mods           = undef,
  $apache_version = $::apache::apache_version,
  $use_systemd    = $::apache::use_systemd,
) {
  # These are modules required to run the default configuration.
  # They are not configurable at this time, so we just include
  # them to make sure it works.
  case $::osfamily {
    'redhat': {
      ::apache::mod { 'log_config': }
      if versioncmp($apache_version, '2.4') >= 0 {
        # Lets fork it
        # Do not try to load mod_systemd on RHEL/CentOS 6 SCL.
        if ( !($::osfamily == 'redhat' and versioncmp($::operatingsystemrelease, '7.0') == -1) and !($::operatingsystem == 'Amazon') ) {
          if ($use_systemd) {
            ::apache::mod { 'systemd': }
          }
        }
        if ($::operatingsystem == 'Amazon' and $::operatingsystemrelease == '2') {
          ::apache::mod { 'systemd': }
        }
        ::apache::mod { 'unixd': }
      }
    }
    'freebsd': {
      ::apache::mod { 'log_config': }
      ::apache::mod { 'unixd': }
    }
    'Suse': {
      ::apache::mod { 'log_config': }
    }
    default: {}
  }
  case $::osfamily {
    'gentoo': {}
    default: {
      ::apache::mod { 'authz_host': }
    }
  }
  # The rest of the modules only get loaded if we want all modules enabled
  if $all {
    case $::osfamily {
      'debian': {
        include ::apache::mod::authn_core
        include ::apache::mod::reqtimeout
        if versioncmp($apache_version, '2.4') < 0 {
          ::apache::mod { 'authn_alias': }
        }
      }
      'redhat': {
        include ::apache::mod::actions
        include ::apache::mod::authn_core
        include ::apache::mod::cache
        include ::apache::mod::ext_filter
        include ::apache::mod::mime
        include ::apache::mod::mime_magic
        include ::apache::mod::rewrite
        include ::apache::mod::speling
        include ::apache::mod::suexec
        include ::apache::mod::version
        include ::apache::mod::vhost_alias
        ::apache::mod { 'auth_digest': }
        ::apache::mod { 'authn_anon': }
        ::apache::mod { 'authn_dbm': }
        ::apache::mod { 'authz_dbm': }
        ::apache::mod { 'authz_owner': }
        ::apache::mod { 'expires': }
        ::apache::mod { 'include': }
        ::apache::mod { 'logio': }
        ::apache::mod { 'substitute': }
        ::apache::mod { 'usertrack': }

        if versioncmp($apache_version, '2.4') < 0 {
          ::apache::mod { 'authn_alias': }
          ::apache::mod { 'authn_default': }
        }
      }
      'freebsd': {
        include ::apache::mod::actions
        include ::apache::mod::authn_core
        include ::apache::mod::cache
        include ::apache::mod::disk_cache
        include ::apache::mod::headers
        include ::apache::mod::info
        include ::apache::mod::mime_magic
        include ::apache::mod::reqtimeout
        include ::apache::mod::rewrite
        include ::apache::mod::userdir
        include ::apache::mod::version
        include ::apache::mod::vhost_alias
        include ::apache::mod::speling
        include ::apache::mod::filter

        ::apache::mod { 'asis': }
        ::apache::mod { 'auth_digest': }
        ::apache::mod { 'auth_form': }
        ::apache::mod { 'authn_anon': }
        ::apache::mod { 'authn_dbm': }
        ::apache::mod { 'authn_socache': }
        ::apache::mod { 'authz_dbd': }
        ::apache::mod { 'authz_dbm': }
        ::apache::mod { 'authz_owner': }
        ::apache::mod { 'dumpio': }
        ::apache::mod { 'expires': }
        ::apache::mod { 'file_cache': }
        ::apache::mod { 'imagemap':}
        ::apache::mod { 'include': }
        ::apache::mod { 'logio': }
        ::apache::mod { 'request': }
        ::apache::mod { 'session': }
        ::apache::mod { 'unique_id': }
      }
      default: {}
    }
    case $::apache::mpm_module {
      'prefork': {
        include ::apache::mod::cgi
      }
      'worker': {
        include ::apache::mod::cgid
      }
      default: {
        # do nothing
      }
    }
    include ::apache::mod::alias
    include ::apache::mod::authn_file
    include ::apache::mod::autoindex
    include ::apache::mod::dav
    include ::apache::mod::dav_fs
    include ::apache::mod::deflate
    include ::apache::mod::dir
    include ::apache::mod::mime
    include ::apache::mod::negotiation
    include ::apache::mod::setenvif
    ::apache::mod { 'auth_basic': }

    if versioncmp($apache_version, '2.4') >= 0 {
      # filter is needed by mod_deflate
      include ::apache::mod::filter

      # authz_core is needed for 'Require' directive
      ::apache::mod { 'authz_core':
        id => 'authz_core_module',
      }

      # lots of stuff seems to break without access_compat
      ::apache::mod { 'access_compat': }
    } else {
      include ::apache::mod::authz_default
    }

    include ::apache::mod::authz_user

    ::apache::mod { 'authz_groupfile': }
    include ::apache::mod::env
  } elsif $mods {
    ::apache::default_mods::load { $mods: }

    if versioncmp($apache_version, '2.4') >= 0 {
      # authz_core is needed for 'Require' directive
      ::apache::mod { 'authz_core':
        id => 'authz_core_module',
      }

      # filter is needed by mod_deflate
      include ::apache::mod::filter
    }
  } else {
    if versioncmp($apache_version, '2.4') >= 0 {
      # authz_core is needed for 'Require' directive
      ::apache::mod { 'authz_core':
        id => 'authz_core_module',
      }

      # filter is needed by mod_deflate
      include ::apache::mod::filter
    }
  }
}