Skip to content
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
# Ensure specific package version for Varnish, eg 3.0.5-1.el6
# [*runtime_params*]
# Hash of key:value runtime parameters
# [*proxy_protocol*]
# Boolean toggle support for the PROXY protocol.
#
class varnish (
Hash $runtime_params = {},
Expand All @@ -64,6 +66,7 @@
String $service_name = 'varnish',
Optional[String] $vcl_reload_cmd = undef,
String $vcl_reload_path = $facts['path'],
Boolean $proxy_protocol = false,
) {
if $package_ensure == 'present' {
$version_major = regsubst($varnish_version, '^(\d+)\.(\d+).*$', '\1')
Expand Down
19 changes: 18 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,24 @@
'3' => '/usr/bin/varnish_reload_vcl',
}
}

'8': {
$os_service_provider = 'systemd'
$vcl_reload = $varnish::version_major ? {
'6' => '/usr/sbin/varnishreload',
'5' => '/sbin/varnish_reload_vcl',
'4' => '/usr/sbin/varnish_reload_vcl',
'3' => '/usr/bin/varnish_reload_vcl',
}
}
'9': {
$os_service_provider = 'systemd'
$vcl_reload = $varnish::version_major ? {
'6' => '/usr/sbin/varnishreload',
'5' => '/sbin/varnish_reload_vcl',
'4' => '/usr/sbin/varnish_reload_vcl',
'3' => '/usr/bin/varnish_reload_vcl',
}
}
default: {
$os_service_provider = 'systemd'
$vcl_reload = '/usr/sbin/varnish_reload_vcl'
Expand Down
4 changes: 4 additions & 0 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
gpgcheck => '0',
sslverify => '1',
sslcacert => '/etc/pki/tls/certs/ca-bundle.crt',
enabled => '1',
priority => '1',
}

yumrepo { 'varnish-cache-source':
Expand All @@ -47,6 +49,8 @@
gpgcheck => '0',
sslverify => '1',
sslcacert => '/etc/pki/tls/certs/ca-bundle.crt',
enabled => '1',
priority => '1',
}
}

Expand Down
4 changes: 2 additions & 2 deletions templates/varnish.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ ExecStart=/usr/sbin/varnishd <%= scope['::varnish::config::jail_opt'] %> \

if scope['::varnish::listen'].is_a?(Array)
-%>
-a <% scope['::varnish::listen'].each_with_index do |addr, idx| %><%= addr %><% unless addr.include?(':') %>:<%= scope['::varnish::listen_port'] %><% end -%><% if idx != (scope['::varnish::listen'].length-1) -%><%= sep %><% end -%><% end %> \
-a <% scope['::varnish::listen'].each_with_index do |addr, idx| %><%= addr %><% unless addr.include?(':') %>:<%= scope['::varnish::listen_port'] %><%= scope['::varnish::proxy_protocol'] ? ',PROXY' : '' %><% end -%><% if idx != (scope['::varnish::listen'].length-1) -%><%= sep %><% end -%><% end %> \
<% else -%>
-a <%= scope['::varnish::listen'] %>:<%= scope['::varnish::listen_port'] %> \
-a <%= scope['::varnish::listen'] %>:<%= scope['::varnish::listen_port'] %><%= scope['::varnish::proxy_protocol'] ? ',PROXY' : '' %> \
<% end -%>
-T <%= scope['::varnish::admin_listen'] %>:<%= scope['::varnish::admin_port'] %> \
<% if scope['::varnish::version_major'] == '3' -%>
Expand Down