Managing Varnish config files


#1

Ohai

I was wondering how some of you manage Varnish config files, as it is very hard to use parameters/attributes in these things.

Opscode varnish cookbook seems to agree on this and gets the config files from a defined source and/or different cookbook by setting the following attributes:

default[‘varnish’][‘vcl_source’]
default[‘varnish’][‘vcl_cookbook’]

It then puts the template in the following way:

template “#{node[‘varnish’][‘dir’]}/#{node[‘varnish’][‘vcl_conf’]}” do
source node[‘varnish’][‘vcl_source’]
if node[‘varnish’][‘vcl_cookbook’]
cookbook node[‘varnish’][‘vcl_cookbook’]
end
owner "root"
group "root"
mode 0644
notifies :restart, "service[varnish]"
end

This seems like a good idea, but I was wondering how other people are managing this?

Kind regards,
Steven


#2

We actually use a very minimal customized template. Most of the file is standard and we mostly just have logic to turn on/off rules based in the environment.

Then we just drop it off with an application cookbook after the varnish cookbook runs.

On Feb 26, 2013, at 5:05 AM, Steven De Coeyer steven@banteng.be wrote:

Ohai

I was wondering how some of you manage Varnish config files, as it is very hard to use parameters/attributes in these things.

Opscode varnish cookbook seems to agree on this and gets the config files from a defined source and/or different cookbook by setting the following attributes:

default[‘varnish’][‘vcl_source’]
default[‘varnish’][‘vcl_cookbook’]

It then puts the template in the following way:

template “#{node[‘varnish’][‘dir’]}/#{node[‘varnish’][‘vcl_conf’]}” do
source node[‘varnish’][‘vcl_source’]
if node[‘varnish’][‘vcl_cookbook’]
cookbook node[‘varnish’][‘vcl_cookbook’]
end
owner "root"
group "root"
mode 0644
notifies :restart, "service[varnish]"
end

This seems like a good idea, but I was wondering how other people are managing this?

Kind regards,
Steven