-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathserver.pp
More file actions
79 lines (71 loc) · 1.78 KB
/
server.pp
File metadata and controls
79 lines (71 loc) · 1.78 KB
1
2
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
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
# Class: rsync::server
#
# The rsync server. Supports both standard rsync as well as rsync over ssh
#
# Requires:
# class xinetd if use_xinetd is set to true
# class rsync
#
class rsync::server(
$use_xinetd = true,
$address = undef,
$motd_file = undef,
$use_chroot = 'yes',
$uid = 'nobody',
$gid = 'nobody',
$modules = {},
) inherits rsync {
$conf_file = $::osfamily ? {
'Debian' => '/etc/rsyncd.conf',
'suse' => '/etc/rsyncd.conf',
'RedHat' => '/etc/rsyncd.conf',
'FreeBSD' => '/usr/local/etc/rsync/rsyncd.conf',
default => '/etc/rsync.conf',
}
$servicename = $::osfamily ? {
'suse' => 'rsyncd',
'RedHat' => 'rsyncd',
'FreeBSD' => 'rsyncd',
default => 'rsync',
}
if $use_xinetd {
include xinetd
xinetd::service { 'rsync':
bind => $address,
port => '873',
server => '/usr/bin/rsync',
server_args => "--daemon --config ${conf_file}",
require => Package['rsync'],
}
} else {
service { $servicename:
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
subscribe => Concat[$conf_file],
}
if ( $::osfamily == 'Debian' ) {
file { '/etc/default/rsync':
source => 'puppet:///modules/rsync/defaults',
notify => Service['rsync'],
}
}
}
if $motd_file != 'UNSET' {
file { '/etc/rsync-motd':
source => 'puppet:///modules/rsync/motd',
}
}
concat { $conf_file: }
# Template uses:
# - $use_chroot
# - $address
# - $motd_file
concat::fragment { 'rsyncd_conf_header':
target => $conf_file,
content => template('rsync/header.erb'),
order => '00_header',
}
create_resources(rsync::server::module, $modules)
}