diff --git a/manifests/init.pp b/manifests/init.pp index a480bc9..42c513f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,6 @@ -class varnish { +class varnish ( + $listen_port = '80', + $cache = 'malloc,1500m') { package { 'varnish': require => Class['packages::backports'], } # ncsa loggin: @@ -10,8 +12,9 @@ class varnish { file { '/etc/default/varnish': - content => template('varnish/etc_default_varnish.erb'), - notify => Service['varnish']; + content => template('varnish/etc_default_varnish.erb'); + + notify => Service['varnish']; '/etc/default/varnishnsca': content => template('varnish/etc_default_varnishncsa.erb'), diff --git a/templates/etc_default_varnish.erb b/templates/etc_default_varnish.erb index af440a3..d931bf2 100644 --- a/templates/etc_default_varnish.erb +++ b/templates/etc_default_varnish.erb @@ -45,14 +45,13 @@ MEMLOCK=82000 # one content server selected by the vcl file, based on the request. Use a 1GB # fixed-size cache file. # -DAEMON_OPTS="-a :80 \ +DAEMON_OPTS="-a :<%= @listen_port %> \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ - -s malloc,1500m \ - -p thread_pool_min=500 -p thread_pool_max=2048 \ - -p session_max=10000" - + -s <%= @cache %> \ + -p thread_pool_min=500 -p thread_pool_max=2048 \ + -p session_max=10000" #-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" ## Alternative 3, Advanced configuration