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