Defined Type: dbbackups::check_es

Defined in:
modules/dbbackups/manifests/check_es.pp

Overview

Parameters:

  • enabled (Boolean)
  • max_hours (Float[0])
  • email (String)
  • config_file (Stdlib::Unixpath) (defaults to: '/etc/wmfbackups/backups_check.ini')


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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'modules/dbbackups/manifests/check_es.pp', line 16

define dbbackups::check_es (
    Boolean $enabled,
    Float[0] $max_hours,
    String $email,
    Stdlib::Unixpath $config_file = '/etc/wmfbackups/backups_check.ini'
) {
    if $enabled {
        $ensure_file = file
        ensure_packages('wmfbackups-check')
    } else {
        $ensure_file = absent
    }

    file { "/etc/default/${title}":
        ensure  => $ensure_file,
        owner   => 'root',
        group   => 'root',
        mode    => '0400',
        content => template('dbbackups/check-es-config.erb'),
    }

    # remove old config file
    file { '/etc/wmfbackups/my.cnf':
        ensure  => absent,
    }

    if $enabled {
        $ensure_job = 'present'
    } else {
        $ensure_job = 'absent'
    }

    # We believe a weekly schedule should be enough, will add configurability if the needs change.
    # Thursdays UTC mornings looks like a good time (weekly backups start on Tuesdays)
    systemd::timer::job { $title:
        ensure           => $ensure_job,
        user             => 'root',
        description      => 'Checks and alerts by email if ES backups are too slow',
        command          => '/usr/bin/check-dbbackup-time',
        environment_file => "/etc/default/${title}",
        interval         => {'start' => 'OnCalendar', 'interval' => 'Thu *-*-* 01:00:00'},
        require          => [
            File["/etc/default/${title}"],
            Package['wmfbackups-check'],
            File[$config_file],
            User['backupcheck'],
        ]
    }
}