Puppet Class: profile::quarry::trove::backup

Defined in:
modules/profile/manifests/quarry/trove/backup.pp

Overview

Class profile::quarry::trove::backup

Sets up a very simple mysqldump to NFS on a schedule since trove lacks native backup at this time.

You must create a manual config file at /etc/dbdump.cfg that is a basic mysql ini file for setting the host, username and password until quarry has secrets management. Parameter backupdir is used in the templates.

Parameters:

  • backupdir (Stdlib::UnixPath) (defaults to: lookup('profile::quarry::trove::backupdir', {default_value => '/data/project/dbbackups'}))


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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'modules/profile/manifests/quarry/trove/backup.pp', line 9

class profile::quarry::trove::backup (
    Stdlib::UnixPath $backupdir = lookup('profile::quarry::trove::backupdir', {default_value => '/data/project/dbbackups'}),
){
    ensure_packages(['mariadb-client'])

    file { $backupdir:
        ensure => 'directory',
        owner  => 'root',
        group  => 'root',
        mode   => '0700',
    }

    file { '/usr/local/bin/dbdump.sh':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0554',
        content => template('profile/quarry/trove/dbdump.sh.erb'),
    }

    file { '/usr/local/bin/dbdumpcleanup.sh':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0554',
        content => template('profile/quarry/trove/dbdumpcleanup.sh.erb'),
    }

    file { '/var/log/quarry':
        ensure => 'directory',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    systemd::timer::job { 'quarry-dbdump':
        ensure            => 'present',
        user              => 'root',
        description       => 'create a database backup',
        command           => '/usr/local/bin/dbdump.sh',
        logging_enabled   => true,
        logfile_basedir   => '/var/log/quarry/',
        logfile_name      => 'dbdump.log',
        syslog_identifier => 'quarrydumps',
        interval          => {'start' => 'OnCalendar', 'interval' => '*-*-* 0:15:00'},
    }

    systemd::timer::job { 'quarry-cleanup-mysqldump':
        ensure            => 'present',
        user              => 'root',
        description       => 'delete old dump files to avoid running out of disk space',
        command           => '/usr/local/bin/dbdumpcleanup.sh',
        logging_enabled   => true,
        logfile_basedir   => '/var/log/quarry/',
        logfile_name      => 'cleanup-mysqldump.log',
        syslog_identifier => 'quarrydumps-cleanup',
        interval          => {'start' => 'OnCalendar', 'interval' => '*-*-* 23:23:00'},
    }
}