Puppet Class: profile::gerrit::migration

Defined in:
modules/profile/manifests/gerrit/migration.pp

Overview

Allow rsyncing gerrit data to another server for migration and reinstalls.

Parameters:

  • src_host (Stdlib::Fqdn) (defaults to: lookup('profile::gerrit::active_host'))
  • gerrit_site (Stdlib::UnixPath) (defaults to: lookup('profile::gerrit::gerrit_site'))
  • data_dir (Stdlib::Unixpath) (defaults to: lookup('profile::gerrit::migration::data_dir'))
  • daemon_user (String) (defaults to: lookup('profile::gerrit::migration::daemon_user'))


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
# File 'modules/profile/manifests/gerrit/migration.pp', line 3

class profile::gerrit::migration (
    Stdlib::Fqdn        $src_host    = lookup('profile::gerrit::active_host'),
    Stdlib::UnixPath    $gerrit_site = lookup('profile::gerrit::gerrit_site'),
    Stdlib::Unixpath    $data_dir    = lookup('profile::gerrit::migration::data_dir'),
    String              $daemon_user = lookup('profile::gerrit::migration::daemon_user'),
) {
    $dst_hosts = wmflib::class::hosts('gerrit').filter |$host| { $host != $src_host }

    if $facts['fqdn'] in $dst_hosts {

        class { 'rsync::server': }

        rsync::server::module { 'gerrit-data':
            path          => $data_dir,
            read_only     => 'no',
            auto_firewall => true,
            hosts_allow   => [$src_host],
        }

        rsync::server::module { 'gerrit-var-lib':
            path          => $gerrit_site,
            read_only     => 'no',
            auto_firewall => true,
            hosts_allow   => [$src_host],
        }

        file { "/srv/home-${src_host}/":
            ensure => directory,
        }

        if !defined(File[$gerrit_site]) {
            file { $gerrit_site:
                ensure => directory,
            }
        }

        rsync::server::module { 'gerrit-home':
            path          => "/srv/home-${src_host}",
            read_only     => 'no',
            auto_firewall => true,
            hosts_allow   => [$src_host],
        }
    }
}