Puppet Class: aptrepo::rsync
- Defined in:
- modules/aptrepo/manifests/rsync.pp
Summary
sets up rsync of APT repos between 2 servers activates rsync for push from the primary to secondaryOverview
SPDX-License-Identifier: Apache-2.0
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 |
# File 'modules/aptrepo/manifests/rsync.pp', line 7
class aptrepo::rsync (
Stdlib::Fqdn $primary_server,
Array[Stdlib::Fqdn] $secondary_servers,
){
$ensure_sync = ($facts['fqdn'] == $primary_server).bool2str('absent', 'present')
unless $secondary_servers.empty() {
rsync::server::module { 'install-srv':
ensure => $ensure_sync,
path => '/srv',
read_only => 'no',
hosts_allow => [$primary_server],
auto_firewall => true,
}
rsync::server::module { 'install-home':
ensure => $ensure_sync,
path => '/home',
read_only => 'no',
hosts_allow => [$primary_server],
auto_firewall => true,
}
($secondary_servers + $primary_server).each |String $server| {
$ensure_job = ($primary_server == $facts['networking']['fqdn'] and $primary_server != $server).bool2str('present', 'absent')
systemd::timer::job { "rsync-aptrepo-${server}":
ensure => $ensure_job,
user => 'root',
description => 'rsync APT repo data from the primary to a secondary server',
command => "/usr/bin/rsync -avp --delete /srv/ rsync://${server}/install-srv",
interval => {'start' => 'OnUnitInactiveSec', 'interval' => '6h'},
}
}
}
}
|