]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/mysql/recipes/default.rb
Make sure chef mysql configuration overrides defaults
[chef.git] / cookbooks / mysql / recipes / default.rb
index b35eff8f9e9a99e01b09e0e449746ecc216a37e9..07835e729908255066921f67fa3c2a97eda69e4a 100644 (file)
@@ -22,15 +22,26 @@ package "mysql-client"
 
 service "mysql" do
   action [:enable, :start]
-  supports :status => true, :restart => true, :reload => true
+  supports :status => true, :restart => true
 end
 
-template "/etc/mysql/conf.d/chef.cnf" do
+file "/etc/mysql/conf.d/chef.cnf" do
+  action :delete
+  notifies :restart, "service[mysql]"
+end
+
+conf_file = if node[:lsb][:release].to_f >= 16.04
+              "/etc/mysql/mysql.conf.d/zzz-chef.cnf"
+            else
+              "/etc/mysql/conf.d/zzz-chef.cnf"
+            end
+
+template conf_file do
   source "my.cnf.erb"
   owner "root"
   group "root"
-  mode 0644
-  notifies :reload, "service[mysql]"
+  mode 0o644
+  notifies :restart, "service[mysql]"
 end
 
 package "libdbd-mysql-perl"