Puppet Class: deployment::rsync
- Defined in:
- modules/deployment/manifests/rsync.pp
Overview
Class deployment::rsync
Simple class to allow syncing of the deployment directory.
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 68 |
# File 'modules/deployment/manifests/rsync.pp', line 5
class deployment::rsync(
Stdlib::Host $deployment_server,
Wmflib::Ensure $job_ensure = 'absent',
Array[Stdlib::Host] $deployment_hosts = [],
Stdlib::Unixpath $deployment_path = '/srv/deployment',
Stdlib::Unixpath $patches_path = '/srv/patches',
){
include ::rsync::server
rsync::server::module { 'deployment_home':
path => '/home',
read_only => 'yes',
hosts_allow => $deployment_hosts,
}
rsync::server::module { 'deployment_module':
path => $deployment_path,
read_only => 'yes',
hosts_allow => $deployment_hosts,
}
$sync_command = "/usr/bin/rsync -avz --delete ${deployment_server}::deployment_module ${deployment_path}"
systemd::timer::job { 'sync_deployment_dir':
ensure => $job_ensure,
user => 'root',
description => "rsync the deployment server data directory ${deployment_path}",
command => $sync_command,
interval => [
{
'start' => 'OnBootSec', # initially start the unit
'interval' => '10sec',
},{
'start' => 'OnCalendar',
'interval' => '*-*-* *:00:00', # then hourly on the hour
},
],
}
rsync::server::module { 'patches_module':
path => $patches_path,
read_only => 'yes',
hosts_allow => $deployment_hosts,
}
$sync_patches_command = "/usr/bin/rsync -avz --delete ${deployment_server}::patches_module ${patches_path}"
systemd::timer::job { 'sync_patches_dir':
ensure => $job_ensure,
user => 'root',
description => "rsync the deployment server patches directory ${patches_path}",
command => $sync_patches_command,
interval => [
{
'start' => 'OnBootSec', # initially start the unit
'interval' => '15sec',
},{
'start' => 'OnCalendar',
'interval' => '*-*-* *:30:00', # then hourly on the half hour
},
],
}
}
|