]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Rework apt repository configuration
[chef.git] / cookbooks / hardware / recipes / default.rb
index 3d29ade8e9e9734bd346f70432de2322e7b5c7d8..96d3bb9373600e7a0aa4b79e4d1df47158cb717c 100644 (file)
@@ -17,7 +17,6 @@
 # limitations under the License.
 #
 
-include_recipe "apt"
 include_recipe "git"
 include_recipe "munin"
 include_recipe "prometheus"
@@ -57,16 +56,33 @@ end
 
 case manufacturer
 when "HP"
+  include_recipe "apt::management-component-pack"
+
   package "hponcfg"
 
+  execute "update-ilo" do
+    action :nothing
+    command "/usr/sbin/hponcfg -f /etc/ilo-defaults.xml"
+  end
+
+  template "/etc/ilo-defaults.xml" do
+    source "ilo-defaults.xml.erb"
+    owner "root"
+    group "root"
+    mode "644"
+    notifies :run, "execute[update-ilo]"
+  end
+
   package "hp-health" do
     action :install
     notifies :restart, "service[hp-health]"
+    only_if { node[:lsb][:release].to_f < 22.04 }
   end
 
   service "hp-health" do
     action [:enable, :start]
     supports :status => true, :restart => true
+    only_if { node[:lsb][:release].to_f < 22.04 }
   end
 
   if product.end_with?("Gen8", "Gen9")
@@ -199,13 +215,30 @@ service "irqbalance" do
   supports :status => false, :restart => true, :reload => false
 end
 
-# Link Layer Discovery Protocol Daemon
 package "lldpd"
+
 service "lldpd" do
   action [:start, :enable]
   supports :status => true, :restart => true, :reload => true
 end
 
+ohai_plugin "lldp" do
+  template "lldp.rb.erb"
+end
+
+package %w[
+  rasdaemon
+  ruby-sqlite3
+]
+
+service "rasdaemon" do
+  action [:enable, :start]
+end
+
+prometheus_exporter "rasdaemon" do
+  port 9797
+end
+
 tools_packages = []
 status_packages = {}
 
@@ -228,9 +261,6 @@ if node[:virtualization][:role] != "guest" ||
     when "mpt2sas", "mpt3sas"
       tools_packages << "sas2ircu"
       status_packages["sas2ircu-status"] ||= []
-    when "megaraid_mm"
-      tools_packages << "megactl"
-      status_packages["megaraid-status"] ||= []
     when "megaraid_sas"
       tools_packages << "megacli"
       status_packages["megaclisas-status"] ||= []
@@ -283,6 +313,8 @@ else
   end
 end
 
+include_recipe "apt::hwraid" unless status_packages.empty?
+
 if status_packages.include?("cciss-vol-status")
   template "/usr/local/bin/cciss-vol-statusd" do
     source "cciss-vol-statusd.erb"
@@ -295,6 +327,7 @@ if status_packages.include?("cciss-vol-status")
   systemd_service "cciss-vol-statusd" do
     description "Check cciss_vol_status values in the background"
     exec_start "/usr/local/bin/cciss-vol-statusd"
+    nice 10
     private_tmp true
     protect_system "full"
     protect_home true
@@ -311,7 +344,7 @@ else
   end
 end
 
-%w[cciss-vol-status mpt-status sas2ircu-status megaraid-status megaclisas-status aacraid-status].each do |status_package|
+%w[cciss-vol-status mpt-status sas2ircu-status megaclisas-status aacraid-status].each do |status_package|
   if status_packages.include?(status_package)
     package status_package
 
@@ -636,3 +669,7 @@ if node[:hardware][:shm_size]
     notifies :run, "execute[remount-dev-shm]"
   end
 end
+
+prometheus_collector "ohai" do
+  interval "15m"
+end