]> git.openstreetmap.org Git - chef.git/blob - cookbooks/hardware/attributes/default.rb
Merge remote-tracking branch 'github/pull/165'
[chef.git] / cookbooks / hardware / attributes / default.rb
1 default[:hardware][:modules] = if node[:lsb][:release].to_f >= 16.04
2                                  %w[lp]
3                                else
4                                  %w[loop lp rtc]
5                                end
6
7 default[:hardware][:grub][:cmdline] = %w[nomodeset]
8 default[:hardware][:sensors] = {}
9
10 default[:hardware][:mcelog][:enabled] = node[:lsb][:release].to_f < 18.04
11
12 if node[:dmi] && node[:dmi][:system]
13   case node[:dmi][:system][:manufacturer]
14   when "HP"
15     default[:apt][:sources] |= ["management-component-pack"]
16
17     case node[:dmi][:system][:product_name]
18     when "ProLiant DL360 G6", "ProLiant DL360 G7"
19       default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
20     end
21   end
22 end
23
24 if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]).negative?
25   default[:hardware][:modules] |= ["microcode"]
26
27   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
28     default[:hardware][:modules] |= ["coretemp"]
29   end
30 end
31
32 if node[:kernel] && node[:kernel][:modules]
33   raidmods = node[:kernel][:modules].keys & %w[cciss hpsa mptsas mpt2sas mpt3sas megaraid_mm megaraid_sas aacraid]
34
35   default[:apt][:sources] |= ["hwraid"] unless raidmods.empty?
36 end
37
38 if node[:kernel][:modules].include?("ipmi_si")
39   default[:hardware][:modules] |= ["ipmi_devintf"]
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