rsync::site dependency cleanup, part 1
authorPeter Palfrader <peter@palfrader.org>
Tue, 10 Sep 2019 07:25:51 +0000 (09:25 +0200)
committerPeter Palfrader <peter@palfrader.org>
Tue, 10 Sep 2019 07:25:51 +0000 (09:25 +0200)
We define three things: a .service file, a .socket file, and a service.

Previously, the service would require the two files, and the .socket
file would also notify the service.  Change that to the service
subscribing to the files, so it gets a) applied after the files, and
b) refreshed if either changes.

This seems cleaner.  The net change should be that the service gets
also notified if the .service file changes.

modules/roles/templates/snapshot/rsyncd.conf.erb [deleted file]
modules/rsync/manifests/site.pp

diff --git a/modules/roles/templates/snapshot/rsyncd.conf.erb b/modules/roles/templates/snapshot/rsyncd.conf.erb
deleted file mode 100644 (file)
index 67564c9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-uid = nobody
-gid = nogroup
-syslog facility = daemon
-socket options = SO_KEEPALIVE
-reverse lookup = false
-timeout = 7200
-log file = /var/log/rsyncd/rsyncd.log
-
-[snapshot-farm-1]
-  path = /storage/snapshot-farm-1
-  read only = true
-  list = false
-[snapshot-farm-2]
-  path = /storage/snapshot-farm-2
-  read only = true
-  list = false
-[snapshot-farm-3]
-  path = /storage/snapshot-farm-3
-  read only = true
-  list = false
-[snapshot-farm-4]
-  path = /storage/snapshot-farm-4
-  read only = true
-  list = false
-[snapshot-farm-09]
-  path = /storage/snapshot-farm-09
-  read only = true
-  list = false
-[snapshot-farm-10]
-  path = /storage/snapshot-farm-10
-  read only = true
-  list = false
index c762d6d..45836df 100644 (file)
@@ -46,17 +46,14 @@ define rsync::site (
                owner   => 'root',
                group   => 'root',
                mode    => '0444',
-               notify  => [
-                       Exec['systemctl daemon-reload'],
-                       Service["rsyncd-${name}.socket"],
-               ],
+               notify  => Exec['systemctl daemon-reload'],
        }
 
        service { "rsyncd-${name}.socket":
                ensure   => $ensure_service,
                enable   => $ensure_enable,
-               require  => [
-                       Exec['systemctl daemon-reload'],
+               notify   => Exec['systemctl daemon-reload'],
+               subscribe => [
                        File["/etc/systemd/system/rsyncd-${name}@.service"],
                        File["/etc/systemd/system/rsyncd-${name}.socket"],
                ],