-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathdisk_cache.pp
54 lines (51 loc) · 1.86 KB
/
disk_cache.pp
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
# @summary
# Installs and configures `mod_disk_cache`.
#
# @param cache_root
# Defines the name of the directory on the disk to contain cache files.
# Default depends on the Apache version and operating system:
# - Debian: /var/cache/apache2/mod_cache_disk
# - FreeBSD: /var/cache/mod_cache_disk
# - Red Hat: /var/cache/httpd/proxy
#
# @param cache_ignore_headers
# Specifies HTTP header(s) that should not be stored in the cache.
#
# @param default_cache_enable
# Default value is true, which enables "CacheEnable disk /" in disk_cache.conf for the webserver. This would cache
# every request to apache by default for every vhost. If set to false the default cache all behaviour is supressed.
# You can then control this behaviour in individual vhosts by explicitly defining CacheEnable.
#
# @note
# On Apache 2.4, mod_cache_disk installed.
#
# @see https://httpd.apache.org/docs/2.4/mod/mod_cache_disk.html for additional documentation.
#
class apache::mod::disk_cache (
Optional[Stdlib::Absolutepath] $cache_root = undef,
Optional[String] $cache_ignore_headers = undef,
Boolean $default_cache_enable = true,
) {
include apache
if $cache_root {
$_cache_root = $cache_root
} else {
$_cache_root = $facts['os']['family'] ? {
'Debian' => '/var/cache/apache2/mod_cache_disk',
'RedHat' => '/var/cache/httpd/proxy',
'FreeBSD' => '/var/cache/mod_cache_disk',
}
}
apache::mod { 'cache_disk': }
Class['apache::mod::cache'] -> Class['apache::mod::disk_cache']
# Template uses $_cache_root
file { 'disk_cache.conf':
ensure => file,
path => "${apache::mod_dir}/disk_cache.conf",
mode => $apache::file_mode,
content => template('apache/mod/disk_cache.conf.erb'),
require => Exec["mkdir ${apache::mod_dir}"],
before => File[$apache::mod_dir],
notify => Class['apache::service'],
}
}