Puppet Class: profile::wmcs::backy2

Defined in:
modules/profile/manifests/wmcs/backy2.pp

Overview

Parameters:

  • cluster_name (String) (defaults to: lookup('profile::wmcs::backy2::cluster_name'))
  • data_dir (Stdlib::Unixpath) (defaults to: lookup('profile::cloudceph::data_dir'))
  • db_pass (String) (defaults to: lookup('profile::wmcs::backy2::db_pass'))
  • backup_dir (String) (defaults to: lookup('profile::wmcs::backy2::backup_dir'))
  • postgres_root_dir (Stdlib::Unixpath) (defaults to: lookup('profile::wmcs::backy2::postgres_root_dir'))


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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'modules/profile/manifests/wmcs/backy2.pp', line 1

class profile::wmcs::backy2(
    String               $cluster_name      = lookup('profile::wmcs::backy2::cluster_name'),
    Stdlib::Unixpath     $data_dir          = lookup('profile::cloudceph::data_dir'),
    String               $db_pass           = lookup('profile::wmcs::backy2::db_pass'),
    String               $backup_dir        = lookup('profile::wmcs::backy2::backup_dir'),
    Stdlib::Unixpath     $postgres_root_dir = lookup('profile::wmcs::backy2::postgres_root_dir'),
) {
    require profile::cloudceph::auth::deploy
    if ! defined(Ceph::Auth::Keyring['admin']) {
        notify{'profile::wmcs::backy2: Admin keyring not defined, things might not work as expected.': }
    }

    class {'::backy2':
        cluster_name => $cluster_name,
        db_pass      => $db_pass,
        backup_dir   => $backup_dir,
    }

    file { '/usr/lib/python3/dist-packages/rbd2backy2.py':
        ensure => 'present',
        owner  => 'root',
        group  => 'root',
        mode   => '0644',
        source => 'puppet:///modules/profile/wmcs/backy2/rbd2backy2.py';
    }

    # Script to manage backups
    file { '/usr/local/sbin/wmcs-backup':
        ensure => 'present',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
        source => 'puppet:///modules/profile/wmcs/backy2/wmcs-backup.py';
    }

    # Script to cleanup expired backups.  Expiration date is
    #   set when the backups are first created.
    file { '/usr/local/sbin/wmcs-purge-backups':
        ensure => 'present',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
        source => 'puppet:///modules/profile/wmcs/backy2/wmcs-purge-backups.sh';
    }

    class {'::postgresql::server':
        root_dir => $postgres_root_dir,
    }

    postgresql::db { 'backy2':
        owner   => 'backy2',
        require => Class['postgresql::server'];
    }

    postgresql::user { 'backy2':
        ensure   => 'present',
        user     => 'backy2',
        password => $db_pass,
        cidr     => '127.0.0.1/32',
        type     => 'host',
        method   => 'trust',
        database => 'backy2',
        notify   => Exec['initialize-backy2-database'],
    }

    logrotate::rule { 'backy2':
        ensure       => present,
        file_glob    => '/var/log/backy.log',
        frequency    => 'weekly',
        compress     => true,
        missing_ok   => true,
        not_if_empty => true,
        rotate       => 8,
    }
}