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