Puppet Class: profile::piwik::backup

Defined in:
modules/profile/manifests/piwik/backup.pp

Overview

Class: profile::piwik::backup

Periodical backups of the Piwik database tables using Bacula.

Parameters:

  • backup_username (Any) (defaults to: hiera('profile::piwik::backup::username'))
  • backup_password (Any) (defaults to: hiera('profile::piwik::backup::password'))
  • retention_days (Any) (defaults to: 14)


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
# File 'modules/profile/manifests/piwik/backup.pp', line 5

class profile::piwik::backup (
    $backup_username    = hiera('profile::piwik::backup::username'),
    $backup_password    = hiera('profile::piwik::backup::password'),
    $retention_days     = 14,
) {
    include ::profile::backup::host

    file { '/srv/backups':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0600', # implicitly 0700 for dirs
    }

    file { '/etc/mysql/conf.d/dumps.cnf':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0400',
        content => "[client]\nuser=${backup_username}\npassword=\'${backup_password}\'\n",
    }

    # Backups older than 15 days will be deleted by the predump script before
    # the mysqldump, so a cron is not needed.
    backup::mysqlset {'piwik':
        xtrabackup       => false,
        per_db           => true,
        innodb_only      => true,
        binlog           => false,
        slave            => false,
        local_dump_dir   => '/srv/backups',
        password_file    => '/etc/mysql/conf.d/dumps.cnf',
        method           => 'predump',
        mysql_binary     => '/usr/bin/mysql',
        mysqldump_binary => '/usr/bin/mysqldump',
        jobdefaults      => "Weekly-${profile::backup::host::day}-${profile::backup::host::pool}",
    }
}