]> git.openstreetmap.org Git - chef.git/commitdiff
Install isdct on machines with Intel SSDs
authorTom Hughes <tom@compton.nu>
Sun, 22 May 2016 17:50:40 +0000 (18:50 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 22 May 2016 17:54:27 +0000 (18:54 +0100)
cookbooks/hardware/recipes/default.rb

index 5cbb13eb0142ae334e24debde48270c57c502be3..b108a3a9635e9e74317f04a180543e9df7e260ca 100644 (file)
@@ -281,6 +281,45 @@ disks = if node[:hardware][:disk]
           []
         end
 
           []
         end
 
+intel_ssds = disks.select { |d| d[:vendor] == "INTEL" && d[:model] =~ /^SSD/ }
+
+nvmes = if node[:hardware][:pci]
+          node[:hardware][:pci].values.select { |pci| pci[:driver] == "nvme" }
+        else
+          []
+        end
+
+intel_nvmes = nvmes.select { |pci| pci[:vendor_name] == "Intel Corporation" }
+
+if !intel_ssds.empty? || !intel_nvmes.empty?
+  package "unzip"
+  package "alien"
+
+  remote_file "#{Chef::Config[:file_cache_path]}/DataCenterTool_3_0_0_Linux.zip" do
+    source "https://downloadmirror.intel.com/23931/eng/DataCenterTool_3_0_0_Linux.zip"
+  end
+
+  execute "unzip-DataCenterTool" do
+    command "unzip DataCenterTool_3_0_0_Linux.zip isdct-3.0.0.400-15.x86_64.rpm"
+    cwd Chef::Config[:file_cache_path]
+    user "root"
+    group "root"
+    not_if { File.exist?("#{Chef::Config[:file_cache_path]}/isdct-3.0.0.400-15.x86_64.rpm") }
+  end
+
+  execute "alien-isdct" do
+    command "alien --to-deb isdct-3.0.0.400-15.x86_64.rpm"
+    cwd Chef::Config[:file_cache_path]
+    user "root"
+    group "root"
+    not_if { File.exist?("#{Chef::Config[:file_cache_path]}/isdct_3.0.0.400-16_amd64.deb") }
+  end
+
+  dpkg_package "isdct" do
+    source "#{Chef::Config[:file_cache_path]}/isdct_3.0.0.400-16_amd64.deb"
+  end
+end
+
 disks = disks.map do |disk|
   next if disk[:state] == "spun_down"
 
 disks = disks.map do |disk|
   next if disk[:state] == "spun_down"