Defined Type: varnish::remove_instance

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

Overview



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
# File 'modules/varnish/manifests/remove_instance.pp', line 5

define varnish::remove_instance() {
    require ::varnish::common

    $suffix = $title

    exec { "stop-varnish${suffix}":
        user    => 'root',
        path    => '/usr/sbin:/sbin:/usr/bin:/bin',
        command => "service varnish${suffix} stop",
        onlyif  => "service varnish${suffix} status",
    }

    $initfiles = [
        "/etc/init.d/varnish${suffix}",
        "/etc/systemd/system/varnish${suffix}.service",
        "/lib/systemd/system/varnish${suffix}.service",
    ]

    file { $initfiles:
        ensure  => absent,
        require => Exec["stop-varnish${suffix}"],
        notify  => Exec["systemctl-reload-vi${suffix}"],
    }

    exec { "systemctl-reload-vi${suffix}":
        user        => 'root',
        path        => '/usr/sbin:/sbin:/usr/bin:/bin',
        command     => 'systemctl daemon-reload',
        refreshonly => true,
    }

    Varnish::Remove_instance <| |> -> Varnish::Instance <| |>
}