File: cache.pp

package info (click to toggle)
puppet-module-puppetlabs-apache 12.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,664 kB
  • sloc: ruby: 275; sh: 32; makefile: 2
file content (58 lines) | stat: -rw-r--r-- 2,069 bytes parent folder | download
1
2
3
4
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
# @summary
#   Installs `mod_cache`
#
# @param cache_ignore_headers
#   Specifies HTTP header(s) that should not be stored in the cache.
#
# @param cache_default_expire
#   The default duration to cache a document when no expiry date is specified.
#
# @param cache_max_expire
#   The maximum time in seconds to cache a document
#
# @param cache_ignore_no_lastmod
#   Ignore the fact that a response has no Last Modified header.
#
# @param cache_header
#   Add an X-Cache header to the response.
#
# @param cache_lock
#   Enable the thundering herd lock.
#
# @param cache_ignore_cache_control
#   Ignore request to not serve cached content to client
#
# @see https://httpd.apache.org/docs/current/mod/mod_cache.html for additional documentation.
#
class apache::mod::cache (
  Array[String[1]] $cache_ignore_headers              = [],
  Optional[Integer] $cache_default_expire             = undef,
  Optional[Integer] $cache_max_expire                 = undef,
  Optional[Apache::OnOff] $cache_ignore_no_lastmod    = undef,
  Optional[Apache::OnOff] $cache_header               = undef,
  Optional[Apache::OnOff] $cache_lock                 = undef,
  Optional[Apache::OnOff] $cache_ignore_cache_control = undef,
) {
  include apache
  apache::mod { 'cache': }

  $_configuration_file_name = 'cache.conf'

  file { $_configuration_file_name:
    ensure  => file,
    path    => "${apache::mod_dir}/${_configuration_file_name}",
    mode    => $apache::file_mode,
    content => epp('apache/mod/cache.conf.epp', {
        cache_ignore_headers       => $cache_ignore_headers,
        cache_default_expire       => $cache_default_expire,
        cache_max_expire           => $cache_max_expire,
        cache_ignore_no_lastmod    => $cache_ignore_no_lastmod,
        cache_header               => $cache_header,
        cache_lock                 => $cache_lock,
        cache_ignore_cache_control => $cache_ignore_cache_control,
    }),
    require => Exec["mkdir ${apache::mod_dir}"],
    before  => File[$apache::mod_dir],
    notify  => Class['apache::service'],
  }
}