2012-05-14 15:07:28 +00:00
|
|
|
class varnish::debian($version, $vcl_template, $store_file_mb = 1024) {
|
|
|
|
$varnish_user = 'varnish'
|
|
|
|
$varnish_group = 'varnish'
|
2012-05-14 13:15:05 +00:00
|
|
|
|
2012-05-14 15:07:28 +00:00
|
|
|
user { $varnish_user: uid => 27835 }
|
2012-05-14 13:15:05 +00:00
|
|
|
|
2012-05-14 15:07:28 +00:00
|
|
|
$packages = [ 'libpcre3', 'libpcre3-dev', 'pkg-config' ]
|
|
|
|
|
|
|
|
package { $packages: ensure => installed }
|
2012-05-14 13:15:05 +00:00
|
|
|
|
|
|
|
class { 'varnish':
|
|
|
|
version => $version,
|
2012-05-14 15:07:28 +00:00
|
|
|
require => Package[$packages],
|
2012-05-14 13:15:05 +00:00
|
|
|
vcl_template => $vcl_template
|
|
|
|
}
|
|
|
|
|
2012-05-16 10:43:53 +00:00
|
|
|
init_d { 'varnish':
|
2012-05-14 13:15:05 +00:00
|
|
|
init_d_prolog => template('varnish/debian/init-d-prolog'),
|
2012-05-14 15:07:28 +00:00
|
|
|
init_d_prerun => template('varnish/debian/init-d-prerun'),
|
|
|
|
require => Class['varnish']
|
|
|
|
}
|
|
|
|
|
|
|
|
exec { 'ensure-data-store-ownership':
|
|
|
|
command => "chown -R ${varnish_user}:${varnish_group} ${varnish::data}",
|
|
|
|
path => $base::path,
|
2012-05-14 13:15:05 +00:00
|
|
|
require => Class['varnish']
|
|
|
|
}
|
2012-05-14 15:07:28 +00:00
|
|
|
|
|
|
|
logrotate_d { 'varnishncsa':
|
|
|
|
postrotate => 'service varnish rotate',
|
|
|
|
pattern => "${varnish::log}/access.log"
|
|
|
|
}
|
2012-05-14 13:15:05 +00:00
|
|
|
}
|
|
|
|
|