Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@
# or in percentage of available storage space using the % suffix.
# Default: 1G
#
# [*storage_dir*]
# Cache file path
# Default: /var/lib/varnish/${instance}
# Specify 'malloc' to keep the cache wholly in memory.
#
# [*storage_file*]
# Cache file location
# Default: /var/lib/varnish/$INSTANCE/varnish_storage.bin
# Default: /var/lib/varnish/${instance}/varnish_storage.bin
# Specify 'malloc' to keep the cache wholly in memory.
#
# [*vcl_template*]
Expand Down Expand Up @@ -333,6 +338,7 @@
$secret_file = params_lookup( 'secret_file' ),
$ttl = params_lookup( 'ttl' ),
$storage_size = params_lookup( 'storage_size' ),
$storage_dir = params_lookup( 'storage_dir' ),
$storage_file = params_lookup( 'storage_file' ),
$source = params_lookup( 'source' ),
$source_dir = params_lookup( 'source_dir' ),
Expand Down Expand Up @@ -567,6 +573,28 @@
}


### If using file caching, make sure parent directories are created
if $varnish::storage_file != 'malloc' {
exec{'varnish_cache_dir':
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs path => added, rather than hard coded bin paths

command => "/bin/mkdir -p ${varnish::storage_dir}",
unless => "/usr/bin/test -d ${varnish::storage_dir}",
subscribe => File['varnish.conf'],
refreshonly => true,
noop => $varnish::noops,
before => File['varnish_cache_dir_perms'],
}

file {'varnish_cache_dir_perms':
ensure => directory,
path => $varnish::storage_dir,
owner => $varnish::process_user,
group => $varnish::process_user,
mode => 0755,
noop => $varnish::noops,
}
}


### Include custom class if $my_class is set
if $varnish::my_class {
include $varnish::my_class
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
$secret_file = '/etc/varnish/secret'
$ttl = '120'
$storage_size = '1G'
$storage_file = '/var/lib/varnish/$INSTANCE/varnish_storage.bin'
$storage_dir = "/var/lib/varnish/${instance}"
$storage_file = "${storage_dir}/varnish_storage.bin"
$vcl_template = ''
$vcl_source = ''

Expand Down