2 # Cookbook Name:: hardware
5 # Copyright 2012, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 case node[:cpu][:"0"][:vendor_id]
22 package "intel-microcode"
25 case node[:cpu][:"0"][:vendor_id]
27 if node[:lsb][:release].to_f >= 14.04
28 package "amd64-microcode"
32 if node[:dmi] and node[:dmi][:system]
33 case node[:dmi][:system][:manufacturer]
35 manufacturer = node[:dmi][:base_board][:manufacturer]
36 product = node[:dmi][:base_board][:product_name]
38 manufacturer = node[:dmi][:system][:manufacturer]
39 product = node[:dmi][:system][:product_name]
42 manufacturer = "Unknown"
55 when "TYAN Computer Corporation"
60 when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW"
72 if manufacturer == "HP" and node[:lsb][:release].to_f > 11.10
75 git "/opt/hp/hp-legacy" do
77 repository "git://chef.openstreetmap.org/hp-legacy.git"
82 link "/opt/hp/hp-health/bin/hpasmd" do
83 to "/opt/hp/hp-legacy/hpasmd"
86 link "/usr/lib/libhpasmintrfc.so.3.0" do
87 to "/opt/hp/hp-legacy/libhpasmintrfc.so.3.0"
90 link "/usr/lib/libhpasmintrfc.so.3" do
91 to "libhpasmintrfc.so.3.0"
94 link "/usr/lib/libhpasmintrfc.so" do
95 to "libhpasmintrfc.so.3.0"
100 file "/etc/init/ttySttyS#{unit}.conf" do
104 template "/etc/init/ttyS#{unit}.conf" do
105 source "tty.conf.erb"
109 variables :unit => unit, :speed => speed
112 service "ttyS#{unit}" do
113 provider Chef::Provider::Service::Upstart
114 action [ :enable, :start ]
115 supports :status => true, :restart => true, :reload => false
116 subscribes :restart, "template[/etc/init/ttyS#{unit}.conf]"
120 if File.exist?("/etc/default/grub")
121 execute "update-grub" do
123 command "/usr/sbin/update-grub"
126 template "/etc/default/grub" do
131 variables :unit => unit, :speed => speed
132 notifies :run, "execute[update-grub]"
136 execute "update-initramfs" do
138 command "update-initramfs -u -k all"
143 template "/etc/initramfs-tools/conf.d/mdadm" do
144 source "initramfs-mdadm.erb"
148 notifies :run, "execute[update-initramfs]"
151 if node[:kernel][:modules].include?("ipmi_si")
155 if node[:lsb][:release].to_f >= 12.10
158 template "/etc/default/irqbalance" do
159 source "irqbalance.erb"
165 service "irqbalance" do
166 action [ :start, :enable ]
167 supports :status => false, :restart => true, :reload => false
168 subscribes :restart, "template[/etc/default/irqbalance]"
175 node[:kernel][:modules].each_key do |modname|
178 tools_packages << "hpacucli"
179 status_packages["cciss-vol-status"] ||= []
181 tools_packages << "hpacucli"
182 status_packages["cciss-vol-status"] ||= []
184 tools_packages << "lsiutil"
185 #status_packages["mpt-status"] ||= []
187 tools_packages << "sas2ircu"
188 status_packages["sas2ircu-status"] ||= []
190 tools_packages << "megactl"
191 status_packages["megaraid-status"] ||= []
193 tools_packages << "megacli"
194 status_packages["megaclisas-status"] ||= []
196 tools_packages << "arcconf"
197 status_packages["aacraid-status"] ||= []
201 node[:block_device].each do |name,attributes|
202 if attributes[:vendor] == "HP" and attributes[:model] == "LOGICAL VOLUME"
203 if name =~ /^cciss!(c[0-9]+)d[0-9]+$/
204 status_packages["cciss-vol-status"] |= [ "cciss/#{$1}d0" ]
206 Dir.glob("/sys/block/#{name}/device/scsi_generic/*").each do |sg|
207 status_packages["cciss-vol-status"] |= [ File.basename(sg) ]
213 ["hpacucli", "lsiutil", "sas2ircu", "megactl", "megacli", "arcconf"].each do |tools_package|
214 if tools_packages.include?(tools_package)
215 package tools_package
217 package tools_package do
223 ["cciss-vol-status", "mpt-status", "sas2ircu-status", "megaraid-status", "megaclisas-status", "aacraid-status"].each do |status_package|
224 if status_packages.include?(status_package)
225 package status_package
227 template "/etc/default/#{status_package}d" do
228 source "raid.default.erb"
232 variables :devices => status_packages[status_package]
235 service "#{status_package}d" do
236 action [ :start, :enable ]
237 supports :status => false, :restart => true, :reload => false
238 subscribes :restart, "template[/etc/default/#{status_package}d]"
241 package status_package do
245 file "/etc/default/#{status_package}d" do