]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Update formatting of header comments
[chef.git] / cookbooks / hardware / recipes / default.rb
index 66babcc94d6f1c6082e56362442326460cf345b6..1c8a50c45e07f9d8ad80ab1257de30f861d76f8c 100644 (file)
@@ -1,8 +1,8 @@
 #
-# Cookbook Name:: hardware
+# Cookbook:: hardware
 # Recipe:: default
 #
-# Copyright 2012, OpenStreetMap Foundation
+# Copyright:: 2012, OpenStreetMap Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ when "TYAN Computer Corporation"
   units << "0"
 when "Supermicro"
   case product
-  when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW", "SYS-1028U-TN10RT+", "SYS-2028U-TN24R4T+", "Super Server"
+  when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW", "SYS-1028U-TN10RT+", "SYS-2028U-TN24R4T+", "SYS-1029P-WTRT", "Super Server"
     units << "1"
   else
     units << "0"
@@ -267,7 +267,7 @@ if status_packages.include?("cciss-vol-status")
   end
 end
 
-["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 megaraid-status megaclisas-status aacraid-status].each do |status_package|
   if status_packages.include?(status_package)
     package status_package
 
@@ -353,6 +353,9 @@ disks = disks.map do |disk|
         munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}"
       end
     end
+  elsif disk[:device] =~ %r{^/dev/(nvme\d+)n\d+$}
+    device = Regexp.last_match(1)
+    munin = device
   elsif disk[:device]
     device = disk[:device].sub("/dev/", "")
     munin = device
@@ -368,7 +371,7 @@ disks = disks.map do |disk|
   ]
 end
 
-disks = disks.compact
+disks = disks.compact.uniq
 
 if disks.count.positive?
   package "smartmontools"
@@ -532,3 +535,12 @@ unless Dir.glob("/sys/class/hwmon/hwmon*").empty?
     notifies :run, "execute[/etc/sensors.d/chef.conf]"
   end
 end
+
+if node[:hardware][:shm_size]
+  mount "/dev/shm" do
+    action [:mount, :enable]
+    device "tmpfs"
+    fstype "tmpfs"
+    options "rw,nosuid,nodev,size=#{node[:hardware][:shm_size]}"
+  end
+end