Puppet Class: profile::bastionhost::migration

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

Overview

setup rsync to copy home dirs and tftp data for migrating a bastion host

Parameters:

  • src_host (String) (defaults to: lookup('profile::bastionhost::migration::src_host'))
  • dst_host (String) (defaults to: lookup('profile::bastionhost::migration::dst_host'))


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

class profile::bastionhost::migration (
    String $src_host = lookup('profile::bastionhost::migration::src_host'),
    String $dst_host = lookup('profile::bastionhost::migration::dst_host'),
){

    $src_fqdn = "${src_host}.wikimedia.org"
    $dst_fqdn = "${dst_host}.wikimedia.org"

    if $::fqdn == $dst_fqdn {

        ferm::service { 'bast-migration-rsync':
            proto  => 'tcp',
            port   => '873',
            srange => "@resolve((${src_fqdn}))",
        }

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

        file { "/srv/${src_host}":
            ensure => 'directory'
        }

        $backup_dirs = ['home', 'tftpboot', 'prometheus']

        $backup_dirs.each |String $backup_dir| {

            file { "/srv/${src_host}/${backup_dir}":
                ensure => 'directory',
            }

            rsync::server::module { $backup_dir:
                path        => "/srv/${src_host}/${backup_dir}",
                read_only   => 'no',
                hosts_allow => $src_fqdn,
            }
        }
    }
}