Puppet Class: profile::wmcs::backup_cinder_volumes

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

Overview

SPDX-License-Identifier: Apache-2.0

Backup cinder volumes. This profile is expected to be included alongside

profile::wmcs::backy2 which installs necessary scripts and packages.

Parameters:

  • cluster_name (String) (defaults to: lookup('profile::wmcs::backy2::cluster_name'))
  • data_dir (Stdlib::Unixpath) (defaults to: lookup('profile::cloudceph::data_dir'))
  • backup_interval (String) (defaults to: lookup('profile::wmcs::backy2::volume_backup_time'))
  • cleanup_interval (String) (defaults to: lookup('profile::wmcs::backy2::volume_cleanup_time'))
  • enabled (Boolean) (defaults to: lookup('profile::wmcs::backy2::backup_cinder_volumes::enabled'))
  • scheduler_config (Hash) (defaults to: lookup('profile::wmcs::backy2::backup_cinder_volumes::scheduler_config'))


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
# File 'modules/profile/manifests/wmcs/backup_cinder_volumes.pp', line 6

class profile::wmcs::backup_cinder_volumes(
    String               $cluster_name     = lookup('profile::wmcs::backy2::cluster_name'),
    Stdlib::Unixpath     $data_dir         = lookup('profile::cloudceph::data_dir'),
    String               $backup_interval  = lookup('profile::wmcs::backy2::volume_backup_time'),
    String               $cleanup_interval = lookup('profile::wmcs::backy2::volume_cleanup_time'),
    Boolean              $enabled          = lookup('profile::wmcs::backy2::backup_cinder_volumes::enabled'),
    Hash                 $scheduler_config = lookup('profile::wmcs::backy2::backup_cinder_volumes::scheduler_config'),
) {
    require profile::cloudceph::auth::deploy
    require profile::openstack::eqiad1::clientpackages

    if ! defined(Ceph::Auth::Keyring['admin']) {
        notify{'profile::wmcs::backup_glance_images: Admin keyring not defined, things might not work as expected.': }
    }

    file { '/etc/wmcs_backup_volumes.yaml':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => to_yaml($scheduler_config),
    }

    $timers_ensure = $enabled ? {
      true  => present,
      false => absent,
    }

    systemd::timer::job { 'backup_cinder_volumes':
        ensure          => $timers_ensure,
        description     => 'backup cinder volumes',
        exec_start_pre  => '/usr/local/sbin/wmcs-backup volumes delete-expired',
        command         => '/usr/local/sbin/wmcs-backup volumes backup-assigned-volumes',
        interval        => {
          'start'    => 'OnCalendar',
          'interval' => $backup_interval,
        },
        logging_enabled => true,
        user            => 'root',
        require         => File['/usr/local/sbin/wmcs-backup'],
    }

    systemd::timer::job { 'remove_dangling_cinder_snapshots':
        ensure          => $timers_ensure,
        description     => 'backup cinder volumes',
        command         => '/usr/local/sbin/wmcs-backup volumes remove-dangling-snapshots',
        interval        => {
          'start'    => 'OnCalendar',
          'interval' => $cleanup_interval,
        },
        logging_enabled => true,
        user            => 'root',
        require         => File['/usr/local/sbin/wmcs-backup'],
    }
}