]> git.openstreetmap.org Git - chef.git/blob - cookbooks/hardware/attributes/default.rb
Merge pull request #308 from Firefishy/more-404-tiles
[chef.git] / cookbooks / hardware / attributes / default.rb
1 default[:hardware][:modules] = %w[lp]
2 default[:hardware][:grub][:cmdline] = %w[nomodeset]
3 default[:hardware][:sensors] = {}
4
5 if node[:dmi] && node[:dmi][:system]
6   case node[:dmi][:system][:manufacturer]
7   when "HP"
8     default[:apt][:sources] |= ["management-component-pack"]
9
10     case node[:dmi][:system][:product_name]
11     when "ProLiant DL360 G6", "ProLiant DL360 G7", "ProLiant SE326M1R2"
12       default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
13     end
14   end
15 end
16
17 if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]).negative?
18   default[:hardware][:modules] |= ["microcode"]
19
20   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
21     default[:hardware][:modules] |= ["coretemp"]
22   end
23 end
24
25 if node[:kernel] && node[:kernel][:modules]
26   raidmods = node[:kernel][:modules].keys & %w[cciss hpsa mptsas mpt2sas mpt3sas megaraid_mm megaraid_sas aacraid]
27
28   default[:apt][:sources] |= ["hwraid"] unless raidmods.empty?
29 end
30
31 if node[:kernel][:modules].include?("ipmi_si")
32   default[:hardware][:modules] |= ["ipmi_devintf"]
33 end
34
35 if File.exist?("/proc/xen")
36   default[:hardware][:watchdog] = "xen_wdt"
37 elsif node[:kernel][:modules].include?("i6300esb")
38   default[:hardware][:watchdog] = "none"
39 end
40
41 if File.exist?("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor") &&
42    File.read("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor").chomp == "ondemand"
43   default[:sysfs][:cpufreq_ondemand][:comment] = "Tune the ondemand CPU frequency governor"
44   default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/up_threshold"] = "25"
45   default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/sampling_down_factor"] = "100"
46 end