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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'modules/deployment/manifests/rsync.pp', line 5
class deployment::rsync(
Stdlib::Fqdn $deployment_server,
Array[Stdlib::Fqdn] $deployment_hosts = [],
Stdlib::Unixpath $deployment_path = '/srv/deployment',
Stdlib::Unixpath $patches_path = '/srv/patches',
){
if $deployment_hosts.length > 0
{
rsync::quickdatacopy { 'deployment_home':
source_host => $deployment_server,
dest_host => $deployment_hosts,
module_path => '/home',
auto_sync => false,
server_uses_stunnel => true,
}
rsync::quickdatacopy { 'deployment_module':
source_host => $deployment_server,
dest_host => $deployment_hosts,
module_path => $deployment_path,
auto_sync => true,
delete => true,
auto_interval => [
{
'start' => 'OnBootSec', # initially start the unit
'interval' => '10sec',
},{
'start' => 'OnCalendar',
'interval' => '*-*-* *:00:00', # then hourly on the hour
},
],
server_uses_stunnel => true,
}
rsync::quickdatacopy { 'patches_module':
source_host => $deployment_server,
dest_host => $deployment_hosts,
module_path => $patches_path,
auto_sync => true,
delete => true,
auto_interval => [
{
'start' => 'OnBootSec', # initially start the unit
'interval' => '15sec',
},{
'start' => 'OnCalendar',
'interval' => '*-*-* *:30:00', # then hourly on the half hour
},
],
server_uses_stunnel => true,
}
}
# TODO: remove everything below after running puppet
$sync_command = "/usr/bin/rsync -avz --delete ${deployment_server}::deployment_module ${deployment_path}"
systemd::timer::job { 'sync_deployment_dir':
ensure => absent,
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
},
],
}
$sync_patches_command = "/usr/bin/rsync -avz --delete ${deployment_server}::patches_module ${patches_path}"
systemd::timer::job { 'sync_patches_dir':
ensure => absent,
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
},
],
}
}
|