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