X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/6771f9a63eca561ebc8307db4eac88f7b1aeeadc..b8b28fe06033fec880ba9b179e63387ed5a70fa0:/cookbooks/hardware/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 4d797a52b..8c587d9f0 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -22,6 +22,13 @@ when "GenuineIntel" package "intel-microcode" end +case node[:cpu][:"0"][:vendor_id] +when "AuthenticAMD" + if node[:lsb][:release].to_f >= 14.04 + package "amd64-microcode" + end +end + if node[:dmi] and node[:dmi][:system] case node[:dmi][:system][:manufacturer] when "empty" @@ -145,6 +152,23 @@ if node[:kernel][:modules].include?("ipmi_si") package "ipmitool" end +if node[:lsb][:release].to_f >= 12.10 + package "irqbalance" + + template "/etc/default/irqbalance" do + source "irqbalance.erb" + owner "root" + group "root" + mode 0644 + end + + service "irqbalance" do + action [ :start, :enable ] + supports :status => false, :restart => true, :reload => false + subscribes :restart, "template[/etc/default/irqbalance]" + end +end + tools_packages = [] status_packages = {} @@ -223,3 +247,79 @@ end end end end + +if File.exists?("/etc/mdadm/mdadm.conf") + mdadm_conf = edit_file "/etc/mdadm/mdadm.conf" do |line| + line.gsub!(/^MAILADDR .*$/, "MAILADDR admins@openstreetmap.org") + + line + end + + file "/etc/mdadm/mdadm.conf" do + owner "root" + group "root" + mode 0644 + content mdadm_conf + end + + service "mdadm" do + action :nothing + subscribes :restart, "file[/etc/mdadm/mdadm.conf]" + end +end + +template "/etc/modules" do + source "modules.erb" + owner "root" + group "root" + mode 0644 +end + +if node[:lsb][:release].to_f <= 12.10 + service "module-init-tools" do + provider Chef::Provider::Service::Upstart + action :nothing + subscribes :start, "template[/etc/modules]" + end +else + service "kmod" do + provider Chef::Provider::Service::Upstart + action :nothing + subscribes :start, "template[/etc/modules]" + end +end + +if node[:hardware][:watchdog] + package "watchdog" + + template "/etc/default/watchdog" do + source "watchdog.erb" + owner "root" + group "root" + mode 0644 + variables :module => node[:hardware][:watchdog] + end + + service "watchdog" do + action [ :enable, :start ] + end +end + +unless Dir.glob("/sys/class/hwmon/hwmon*").empty? + package "lm-sensors" + + execute "/etc/sensors.d/chef.conf" do + action :nothing + command "/usr/bin/sensors -s" + user "root" + group "root" + end + + template "/etc/sensors.d/chef.conf" do + source "sensors.conf.erb" + owner "root" + group "root" + mode 0644 + notifies :run, "execute[/etc/sensors.d/chef.conf]" + end +end