]> git.openstreetmap.org Git - chef.git/commitdiff
Move cron customisation for tile caches to the tools cookbook
authorTom Hughes <tom@compton.nu>
Sun, 16 Feb 2020 17:09:02 +0000 (17:09 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 16 Feb 2020 17:09:02 +0000 (17:09 +0000)
cookbooks/tilecache/recipes/default.rb
cookbooks/tools/attributes/default.rb [new file with mode: 0644]
cookbooks/tools/recipes/default.rb
roles/tilecache.rb

index 1cf0e7b2e0c9a4b4d03f3680915250152b7b5b01..f1bab2e574e8c92e36c27d2b44756506da5427ac 100644 (file)
@@ -110,16 +110,6 @@ template "/etc/logrotate.d/squid" do
   mode 0o644
 end
 
-# Configure cron with lower cpu and IO priority
-systemd_service "cron-load" do
-  service "cron"
-  dropin "load"
-  nice 19
-  io_scheduling_class "best-effort"
-  io_scheduling_priority 7
-  notifies :restart, "service[cron]"
-end
-
 nginx_site "default" do
   action [:delete]
 end
diff --git a/cookbooks/tools/attributes/default.rb b/cookbooks/tools/attributes/default.rb
new file mode 100644 (file)
index 0000000..b77bd1b
--- /dev/null
@@ -0,0 +1 @@
+default[:tools][:cron] = {}
index 8b6fbfc623ce5d40294a15ad65e21d0dd9bc3932..b5e12de2c8b000bd6e216b2d51523d6a87c805be 100644 (file)
@@ -58,6 +58,18 @@ systemd_service "cron-timezone" do
   only_if { node[:timezone] }
 end
 
+# Configure cron with lower cpu and IO priority
+if node[:tools][:cron][:load]
+  systemd_service "cron-load" do
+    service "cron"
+    dropin "load"
+    nice node[:tools][:cron][:load][:nice]
+    io_scheduling_class node[:tools][:cron][:load][:io_scheduling_class]
+    io_scheduling_priority node[:tools][:cron][:load][:io_scheduling_priority]
+    notifies :restart, "service[cron]"
+  end
+end
+
 # Make sure cron is running
 service "cron" do
   action [:enable, :start]
index d60617107dcbf4468d781a33e9b58aa46d1813dc..dc6fadf7b70c3dea917d1dd9fd8b2b245d4c99ad 100644 (file)
@@ -74,6 +74,15 @@ default_attributes(
         "kernel.sched_wakeup_granularity_ns" => "15000000"
       }
     }
+  },
+  :tools => {
+    :cron => {
+      :load => {
+        :nice => 19,
+        :io_scheduling_class => "best-effort",
+        :io_scheduling_priority => 7
+      }
+    }
   }
 )