Puppet Class: profile::wmcs::backup_glance_images

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

Overview

SPDX-License-Identifier: Apache-2.0

Backup glance images. 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'))
  • ceph_image_pool (String) (defaults to: lookup('profile::cloudceph::client::rbd::glance::pool'))
  • backup_interval (String) (defaults to: lookup('profile::wmcs::backy2::image_backup_time'))
  • enabled (Boolean) (defaults to: lookup('profile::wmcs::backy2::backup_glance_images::enabled'))


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

class profile::wmcs::backup_glance_images(
    String               $cluster_name    = lookup('profile::wmcs::backy2::cluster_name'),
    Stdlib::Unixpath     $data_dir        = lookup('profile::cloudceph::data_dir'),
    String               $ceph_image_pool = lookup('profile::cloudceph::client::rbd::glance::pool'),
    String               $backup_interval = lookup('profile::wmcs::backy2::image_backup_time'),
    Boolean              $enabled         = lookup('profile::wmcs::backy2::backup_glance_images::enabled'),
) {
    require profile::cloudceph::auth::deploy
    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_images.yaml':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => template('profile/wmcs/backy2/wmcs_backup_images.yaml.erb');
    }

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

    systemd::timer::job { 'backup_glance_images':
        ensure          => $timers_ensure,
        description     => 'backup images',
        command         => '/usr/local/sbin/wmcs-backup images backup-all-images',
        interval        => {
          'start'    => 'OnCalendar',
          'interval' => $backup_interval,
        },
        logging_enabled => true,
        user            => 'root',
        require         => File['/usr/local/sbin/wmcs-backup'],
    }
}