]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Initial work to manage lm_sensors
[chef.git] / cookbooks / hardware / recipes / default.rb
index 59a078894b9cebbee5c053c27ec5927546a9beb9..f6eb31ee396d3e7a2c8e0309fe01c4ff43afa625 100644 (file)
@@ -247,3 +247,44 @@ 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
+
+unless Dir.glob("/sys/class/hwmon/hwmon*").empty?
+  package "lm-sensors"
+
+  execute "/etc/sensors.d/chef.conf" do
+    action :nothing
+    command "/usr/bin/sensors -s"
+    user "root"
+    group "root"
+  end
+
+  template "/etc/sensors.d/chef.conf" do
+    source "sensors.conf.erb"
+    owner "root"
+    group "root"
+    mode 0644
+    notifies :run, "execute[/etc/sensors.d/chef.conf]"
+  end
+end