Cookbooks
varnish
documentation
Varnish Config

Back to resource list

varnish_config

Configures the Varnish service through the defaults or systemd init file. If you do not include this, the config files that come with your distro package will be used instead.

Actions

ActionDescription
:configureCreates the varnish configuration file from template

Properties

NameTypeDefault
conf_sourceStringdefault_systemd.erb
max_open_filesInteger131_072
max_locked_memoryInteger82_000
major_versionMinor supported releasenode['varnish']['major_version']
instance_nameStringNode hostname
listen_addressStringnil
listen_portInteger6081
secondary_listen_addressStringnil
secondary_listen_portIntegernil
admin_listen_addressString'127.0.0.1'
admin_listen_portInteger6082
storage'malloc' or 'file''file'
file_storage_pathString'/var/lib/varnish/%s_storage.bin'
file_storage_sizeString'1G'
malloc_percentInteger33
malloc_sizeStringnil
path_to_secretString'/etc/varnish/secret'
reload_cmdStringnode['varnish']['reload_cmd']

You can also send a hash to parameters which will add additional parameters to the varnish daemon via the -p option. The default hash is:

{
  'thread_pools' => '4',
  'thread_pool_min' => '5',
  'thread_pool_max' => '500',
  'thread_pool_timeout' => '300'
}

Examples

varnish_config 'default' do
  listen_address '0.0.0.0'
  listen_port 80
  storage 'malloc'
  malloc_percent 33
end