From 2223134b7326631ba9e56b328b3963c7f68b1272 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 22 May 2016 18:50:40 +0100 Subject: [PATCH] Install isdct on machines with Intel SSDs --- cookbooks/hardware/recipes/default.rb | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 5cbb13eb0..b108a3a96 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -281,6 +281,45 @@ disks = if node[:hardware][:disk] [] 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" -- 2.39.5