]> git.openstreetmap.org Git - chef.git/commitdiff
Manage statically loaded modules
authorTom Hughes <tom@compton.nu>
Thu, 24 Jul 2014 17:29:03 +0000 (18:29 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 24 Jul 2014 17:31:58 +0000 (18:31 +0100)
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/recipes/default.rb
cookbooks/hardware/templates/default/modules.erb [new file with mode: 0644]
roles/shenron.rb
roles/tyan-s7010.rb

index 8b794cab78df5e2e6396374215f90d7fdbce08bb..46b5893a8746398535b02ab02c4cc7184465e59e 100644 (file)
@@ -1,3 +1,4 @@
+default[:hardware][:modules] = [ "loop", "lp", "rtc" ]
 default[:hardware][:sensors] = {}
 
 if node[:dmi] and node[:dmi][:system]
 default[:hardware][:sensors] = {}
 
 if node[:dmi] and node[:dmi][:system]
@@ -12,6 +13,14 @@ if node[:dmi] and node[:dmi][:system]
   end
 end
 
   end
 end
 
+if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]) < 0
+  default[:hardware][:modules] |= [ "microcode" ]
+
+  if node[:cpu]["0"][:vendor_id] == "GenuineIntel"
+    default[:hardware][:modules] |= [ "coretemp" ]
+  end
+end
+
 if node[:kernel] and node[:kernel][:modules]
   raidmods = node[:kernel][:modules].keys & ["cciss", "hpsa", "mptsas", "mpt2sas", "megaraid_mm", "megaraid_sas", "aacraid"]
 
 if node[:kernel] and node[:kernel][:modules]
   raidmods = node[:kernel][:modules].keys & ["cciss", "hpsa", "mptsas", "mpt2sas", "megaraid_mm", "megaraid_sas", "aacraid"]
 
@@ -20,6 +29,10 @@ if node[:kernel] and node[:kernel][:modules]
   end
 end
 
   end
 end
 
+if node[:kernel][:modules].include?("ipmi_si")
+  default[:hardware][:modules] |= [ "ipmi_devintf" ]
+end
+
 if File.exists?("/proc/xen")
   default[:hardware][:watchdog] = "xen_wdt"
 elsif node[:kernel][:modules].include?("i6300esb")
 if File.exists?("/proc/xen")
   default[:hardware][:watchdog] = "xen_wdt"
 elsif node[:kernel][:modules].include?("i6300esb")
index 689034a2abba002d4f057dccb4176ae981c855cf..0de7c69be1c04d04dcf72e0712fc5e96247370f7 100644 (file)
@@ -248,6 +248,27 @@ end
   end
 end
 
   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"
 
 if node[:hardware][:watchdog]
   package "watchdog"
 
diff --git a/cookbooks/hardware/templates/default/modules.erb b/cookbooks/hardware/templates/default/modules.erb
new file mode 100644 (file)
index 0000000..9ba59d2
--- /dev/null
@@ -0,0 +1,5 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<% node[:hardware][:modules].each do |m| -%>
+<%= m %>
+<% end -%>
index d5fd177f8d2e22ff87d09d219d3eb6da7066ff8f..191c6429ff7c4b8bcec17cb621fa82d7e297f71b 100644 (file)
@@ -16,6 +16,11 @@ default_attributes(
       :max_requests_per_child => 2000
     }
   },
       :max_requests_per_child => 2000
     }
   },
+  :hardware => {
+    :modules => [
+      "it87"
+    ],
+  },
   :networking => {
     :interfaces => {
       :external_ipv4 => {
   :networking => {
     :interfaces => {
       :external_ipv4 => {
index 156d672d70e1e0275d2ac9ea1192b2700617f967..583ad5d9b5e787f6168c58b5f4602c1e155633d7 100644 (file)
@@ -3,6 +3,9 @@ description "Role applied to machines using the Tyan S710 motherboard"
 
 default_attributes(
   :hardware => {
 
 default_attributes(
   :hardware => {
+    :modules => [
+      "i2c_i801", "jc42", "w83793"
+    ],
     :sensors => {
       "jc42-*" => {
         :temps => { 
     :sensors => {
       "jc42-*" => {
         :temps => {