Puppet Class: profile::phabricator::datasync
- Defined in:
- modules/profile/manifests/phabricator/datasync.pp
Overview
SPDX-License-Identifier: Apache-2.0 phabricator - data syncing between servers
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'modules/profile/manifests/phabricator/datasync.pp', line 4
class profile::phabricator::datasync (
Stdlib::Fqdn $active_server = lookup('phabricator_active_server',
{ 'default_value' => undef }),
Stdlib::Fqdn $passive_server = lookup('phabricator_passive_server',
{ 'default_value' => undef }),
Array[Stdlib::Fqdn] $dumps_rsync_clients = lookup('profile::phabricator::main::dumps_rsync_clients'),
Stdlib::Unixpath $home_sync_dir= lookup('profile::phabricator::datasync::home_sync_dir',
{ 'default_value' => '/srv/homes' }),
){
$phabricator_servers = [ $active_server, $passive_server ]
# Allow dumps servers to pull dump files.
rsync::server::module { 'srv-dumps':
path => '/srv/dumps',
read_only => 'yes',
hosts_allow => $dumps_rsync_clients,
auto_firewall => true,
}
# Allow other phab servers to pull tarballs with home dir files.
file { $home_sync_dir: ensure => directory,}
file { '/usr/local/bin/backup-home-dirs':
ensure => present,
content => "#!/bin/bash\nfor user in \$(ls /home); do\ntar czfv /srv/homes/\${user}-\$(hostname -s).tar.gz /home/\${user}; done",
mode => '0555',
owner => 'root',
group => 'root',
}
$timer_ensure = ($active_server == $::fqdn)? {
true => 'present',
default => 'absent',
}
systemd::timer::job { 'backup-home-dirs':
ensure => $timer_ensure,
description => 'create tarballs from /home dirs into /srv/homes',
user => 'root',
command => '/usr/local/bin/backup-home-dirs',
interval => {'start' => 'OnCalendar', 'interval' => '*-*-* 0:10:00'},
require => File['/usr/local/bin/backup-home-dirs'],
}
rsync::quickdatacopy { 'phabricator-home-dirs':
ensure => present,
auto_sync => true,
delete => true,
source_host => $active_server,
dest_host => $passive_server,
module_path => $home_sync_dir,
}
rsync::quickdatacopy { 'phabricator-repos':
ensure => present,
auto_sync => true,
delete => true,
source_host => $active_server,
dest_host => $passive_server,
module_path => '/srv/repos',
ignore_missing_file_errors => true,
}
}
|