Puppet Class: profile::installserver::migration

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

Overview

SPDX-License-Identifier: Apache-2.0 Class to be added to the installserver role to allow copying files for a migration to a new server. Define source host, destination host and data directory in Hiera to get rsyncd and ferm rules on the destination host. Then manually push from the source to one or multiple destinations.

Parameters:

  • src_host (Stdlib::Fqdn) (defaults to: lookup(profile::installserver::migration::rsync_src_host))
  • dst_hosts (Array[Stdlib::Fqdn]) (defaults to: lookup(profile::installserver::migration::rsync_dst_hosts))
  • data_dir (String) (defaults to: lookup(profile::installserver::migration::rsync_data_dir))


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

class profile::installserver::migration (
    Stdlib::Fqdn $src_host = lookup(profile::installserver::migration::rsync_src_host),
    Array[Stdlib::Fqdn] $dst_hosts = lookup(profile::installserver::migration::rsync_dst_hosts),
    String $data_dir = lookup(profile::installserver::migration::rsync_data_dir),
) {

    file { "/srv/${data_dir}-${src_host}":
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    if $::fqdn in $dst_hosts {

        firewall::service { 'installserver-migration-rsync':
            proto  => 'tcp',
            port   => 873,
            srange => $src_host,
        }

        class { '::rsync::server': }

        rsync::server::module { "installserver-${data_dir}":
            path        => "/srv/${data_dir}-${src_host}/",
            read_only   => 'no',
            hosts_allow => $src_host,
        }

    }
}