Defined Type: varnish::config

Defined in:
puppet/modules/varnish/manifests/config.pp

Overview

Define: varnish::config

Sets up a new Varnish config file.

Parameters

source

VCL file source.

content

VCL file content.

order

Order in which Varnish will apply your configuration (0-99). Default: 60 (apply just after default VCL).

Examples

varnish::config { 'thumbor':
    source => 'puppet:///modules/thumbor/varnish.vcl',
    order  => 99,
}

Parameters:

  • source (Any) (defaults to: undef)
  • content (Any) (defaults to: undef)
  • order (Any) (defaults to: 60)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'puppet/modules/varnish/manifests/config.pp', line 24

define varnish::config(
    $source = undef,
    $content = undef,
    $order = 60,
) {
    include ::varnish

    $i = sprintf('%02d', $order)
    $path = "${::varnish::confd}/${i}-${title}.vcl"

    file { $path:
        source  => $source,
        content => $content,
        mode    => '0644',
        notify  => Service['varnish'],
    }

    file_line { "${::varnish::conf}:${title}":
        line    => "include \"${path}\";",
        path    => $::varnish::conf,
        match   => "${::varnish::confd}/[0-9]+-${title}.vcl",
        require => File[$path],
        notify  => Exec['varnish_sort_confd'],
    }
}