]> git.openstreetmap.org Git - chef.git/commitdiff
Add basic watchdog support for VMs
authorTom Hughes <tom@compton.nu>
Mon, 21 Jul 2014 18:57:41 +0000 (19:57 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 21 Jul 2014 18:57:58 +0000 (19:57 +0100)
cookbooks/hardware/recipes/default.rb
cookbooks/hardware/templates/default/watchdog.erb [new file with mode: 0644]

index 59a078894b9cebbee5c053c27ec5927546a9beb9..7923d3868d0213e8114ba0225c3628c78f9a2fac 100644 (file)
@@ -247,3 +247,25 @@ end
     end
   end
 end
     end
   end
 end
+
+if File.exists?("/proc/xen")
+  watchdog = "xen_wdt"
+elsif node[:kernel][:modules].include?("i6300esb")
+  watchdog = "none"
+end
+
+if watchdog
+  package "watchdog"
+
+  template "/etc/default/watchdog" do
+    source "watchdog.erb"
+    owner "root"
+    group "root"
+    mode 0644
+    variables :module => watchdog
+  end
+
+  service "watchdog" do
+    action [ :enable, :start ]
+  end
+end
diff --git a/cookbooks/hardware/templates/default/watchdog.erb b/cookbooks/hardware/templates/default/watchdog.erb
new file mode 100644 (file)
index 0000000..afeef44
--- /dev/null
@@ -0,0 +1,7 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Start watchdog at boot time? 0 or 1
+run_watchdog=1
+# Load module before starting watchdog
+watchdog_module="<%= @module %>"
+# Specify additional watchdog options here (see manpage).