]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Send mdadm notification to the admins list
[chef.git] / cookbooks / hardware / recipes / default.rb
index 689034a2abba002d4f057dccb4176ae981c855cf..8c587d9f0d172122c2818ab72f27b91f60926851 100644 (file)
@@ -248,6 +248,47 @@ end
   end
 end
 
+if File.exists?("/etc/mdadm/mdadm.conf")
+  mdadm_conf = edit_file "/etc/mdadm/mdadm.conf" do |line|
+    line.gsub!(/^MAILADDR .*$/, "MAILADDR admins@openstreetmap.org")
+
+    line
+  end
+
+  file "/etc/mdadm/mdadm.conf" do
+    owner "root"
+    group "root"
+    mode 0644
+    content mdadm_conf
+  end
+
+  service "mdadm" do
+    action :nothing
+    subscribes :restart, "file[/etc/mdadm/mdadm.conf]"
+  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"