Send mdadm notification to the admins list
authorTom Hughes <tom@compton.nu>
Mon, 4 Aug 2014 07:29:43 +0000 (08:29 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 4 Aug 2014 07:33:32 +0000 (08:33 +0100)
cookbooks/hardware/recipes/default.rb

index 0de7c69be1c04d04dcf72e0712fc5e96247370f7..8c587d9f0d172122c2818ab72f27b91f60926851 100644 (file)
@@ -248,6 +248,26 @@ 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"