$socket_file = "/etc/systemd/system/rsyncd-${name}.socket"
$systemd_service = "rsyncd-${name}.socket"
+ # if we enable the service, we want the files before the service.
+ # if we remove the service, we want the service disabled before the files
+ # go away.
+ $service_subscribe = $ensure ? {
+ present => [
+ File[$service_file],
+ File[$socket_file],
+ ],
+ default => [],
+ }
+ $service_before = $ensure ? {
+ present => [],
+ default => [
+ File[$service_file],
+ File[$socket_file],
+ ],
+ }
+
file { $service_file:
ensure => $ensure,
content => template('rsync/systemd-rsyncd.service.erb'),
ensure => $ensure_service,
enable => $ensure_enable,
notify => Exec['systemctl daemon-reload'],
- subscribe => [
- File[$service_file],
- File[$socket_file],
- ],
provider => systemd,
+ before => $service_before,
+ subscribe => $service_subscribe,
}
if $sslname {