Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
class rsync::server(
Boolean $use_xinetd = true,
$address = '0.0.0.0',
$address = 'UNSET',
$motd_file = 'UNSET',
Variant[Enum['UNSET'], Stdlib::Absolutepath] $pid_file = '/var/run/rsyncd.pid',
$use_chroot = 'yes',
Expand All @@ -26,12 +26,17 @@
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'],
}

if ($address != 'UNSET') {
Xinetd::Service['rsync'] {
bind => $address,
}
}
} else {

# Manage the installation of the rsyncd package?
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
describe 'when using default params' do
it {
is_expected.to contain_class('xinetd')
is_expected.to contain_xinetd__service('rsync').with(bind: '0.0.0.0')
is_expected.to contain_xinetd__service('rsync').with(port: 873)
is_expected.not_to contain_service('rsync')
is_expected.not_to contain_file('/etc/rsync-motd')
is_expected.to contain_concat__fragment('rsyncd_conf_header').with(order: '00_header')
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^use chroot\s*=\s*yes$})
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^address\s*=\s*0.0.0.0$})
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^pid file\s*=\s*/var/run/rsyncd.pid$})
}
end
Expand Down Expand Up @@ -76,6 +75,7 @@
end

it {
is_expected.to contain_xinetd__service('rsync').with(bind: '10.0.0.42')
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^address\s*=\s*10.0.0.42$})
}
end
Expand Down
2 changes: 2 additions & 0 deletions templates/header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use chroot = <%= @use_chroot %>
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
<% if @address != 'UNSET' -%>
address = <%= @address %>
<% end -%>
<% if @motd_file != 'UNSET' -%>
motd file = <%= @motd_file %>
<% end -%>