Defined Type: varnish::wikimedia_vcl

Defined in:
modules/varnish/manifests/wikimedia_vcl.pp

Overview

Parameters:

  • varnish_testing (Any) (defaults to: false)
  • template_path (Any) (defaults to: '')
  • vcl_config (Any) (defaults to: {})
  • backend_caches (Any) (defaults to: [])
  • backend_options (Any) (defaults to: {})
  • vcl (Any) (defaults to: '')
  • generate_extra_vcl (Any) (defaults to: false)
  • is_separate_vcl (Any) (defaults to: false)
  • wikimedia_nets (Any) (defaults to: [])
  • wikimedia_trust (Any) (defaults to: [])


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'modules/varnish/manifests/wikimedia_vcl.pp', line 1

define varnish::wikimedia_vcl(
    $varnish_testing = false,
    $template_path = '',
    $vcl_config = {},
    $backend_caches = [],
    $backend_options = {},
    $vcl = '',
    $generate_extra_vcl = false,
    $is_separate_vcl=false,
    $wikimedia_nets=[],
    $wikimedia_trust=[],
) {
    if $varnish_testing  {
        $dynamic_backend_caches = false
        $netmapper_dir = '/usr/share/varnish/tests'
    } else {
        $dynamic_backend_caches = hiera('varnish::dynamic_backend_caches', true)
        $netmapper_dir = '/var/netmapper'
    }

    # Hieradata switch to shut users out of a DC/cluster. T129424
    $traffic_shutdown = hiera('cache::traffic_shutdown', false)

    if $generate_extra_vcl {
        $extra_vcl_name = regsubst($title, '^([^ ]+) .*$', '\1')
        $extra_vcl_filename = "/etc/varnish/${extra_vcl_name}.inc.vcl"
        if !defined(File[$extra_vcl_filename]) {
            file { $extra_vcl_filename:
                owner   => 'root',
                group   => 'root',
                mode    => '0444',
                content => template("varnish/${extra_vcl_name}.inc.vcl.erb"),
            }
        }
    } else {
        file { $title:
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template($template_path),
            notify  => $notify,
            require => $require,
            before  => $before,
        }
    }
}