From 5d9ba7938bce3e137fe52334c130f6e6df693211 Mon Sep 17 00:00:00 2001 From: Grant - Veeps Hosting Date: Tue, 4 Jun 2024 11:29:50 +1000 Subject: [PATCH] Fixed https://github.com/voxpupuli/puppet-varnish/issues/57 --- manifests/init.pp | 6 +++++- templates/varnish-conf.erb | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 325d9d1..b6e6c7b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,6 +13,9 @@ # passed to varnish conf-file # @param storage_type # which storage will be used for varnish - default malloc +# @param transient_malloc +# Configure transient memory allocation if requried (optional) +# Example hiera config varnish::transient_malloc: '512m' # @param varnish_vcl_conf # path to main vcl file # @param varnish_user @@ -82,7 +85,7 @@ # Add varnish::hitch class to install hitch # @param add_ncsa # Add varnish::ncsa class to install varnishncsa Service -# +# # @example Installs Varnish # # enables Varnish service # # uses default VCL '/etc/varnish/default.vcl' @@ -105,6 +108,7 @@ String $nfiles = '131072', String $memlock = '100M', String $storage_type = 'malloc', + String $transient_malloc = 'undef', Stdlib::Absolutepath $varnish_vcl_conf = '/etc/varnish/default.vcl', String $varnish_user = 'varnish', Optional[String] $varnish_jail_user = undef, diff --git a/templates/varnish-conf.erb b/templates/varnish-conf.erb index aeb8b14..34b8100 100644 --- a/templates/varnish-conf.erb +++ b/templates/varnish-conf.erb @@ -106,6 +106,9 @@ DAEMON_OPTS="-a <%= scope.lookupvar('varnish_listen_address') %>:<%= scope.looku <% else -%> -s <%= scope.lookupvar('storage_type') %>,<%= scope.lookupvar('varnish_storage_file') %>,<%= scope.lookupvar('varnish_storage_size') %> \ <% end -%> +<% if scope.lookupvar('storage_type') == 'malloc' && scope.lookupvar('transient_malloc') != 'undef' -%> + -s Transient=<%= scope.lookupvar('storage_type') %>,<%= scope.lookupvar('transient_malloc') %> +<% end -%> <% if @vcl_dir -%> -p vcl_dir=<%= @vcl_dir %> \ <% end -%>