+systemd_timer "replication-daily" do
+ description "Daily replication"
+ on_calendar "*-*-* *:02/15:00"
+end
+
+## Replication cleanup
+
+systemd_service "replication-cleanup" do
+ description "Cleanup replication"
+ user "planet"
+ exec_start "/usr/local/bin/replicate-cleanup"
+ private_tmp true
+ private_devices true
+ private_network true
+ protect_system "full"
+ protect_home true
+ no_new_privileges true
+end
+
+systemd_timer "replication-cleanup" do
+ description "Cleanup replication"
+ on_boot_sec 60
+ on_unit_active_sec 86400
+ accuracy_sec 1800
+end
+
+## Enable/disable feeds
+
+if node[:planet][:replication] == "enabled"
+ service "users-agreed.timer" do
+ action [:enable, :start]
+ end
+
+ service "users-deleted.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-changesets.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-minutely.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-hourly.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-daily.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-cleanup.timer" do
+ action [:enable, :start]
+ end
+else
+ service "users-agreed.timer" do
+ action [:stop, :disable]
+ end
+
+ service "users-deleted.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-changesets.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-minutely.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-hourly.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-daily.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-cleanup.timer" do
+ action [:stop, :disable]
+ end