From: Tom Hughes Date: Mon, 21 Jul 2014 18:57:41 +0000 (+0100) Subject: Add basic watchdog support for VMs X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/6027abf8c73b183a22603e3de22799a52b993f39 Add basic watchdog support for VMs --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 59a078894..7923d3868 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -247,3 +247,25 @@ 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 index 000000000..afeef4448 --- /dev/null +++ b/cookbooks/hardware/templates/default/watchdog.erb @@ -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).