]> git.openstreetmap.org Git - chef.git/commitdiff
Use mariadb instead of mysql on debian
authorTom Hughes <tom@compton.nu>
Wed, 22 Mar 2023 20:32:16 +0000 (20:32 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 22 Mar 2023 23:58:43 +0000 (23:58 +0000)
cookbooks/mysql/recipes/default.rb
test/integration/donate/serverspec/mysql_spec.rb
test/integration/mysql/serverspec/mysql_spec.rb

index aad3a7683d2f5833c0ce0bacb5c898bd69016282..2336bc1f75aed739da270739bd124615c4df0aa7 100644 (file)
 include_recipe "munin"
 include_recipe "prometheus"
 
-package "mysql-server"
-package "mysql-client"
+mysql_variant = if platform?("ubuntu")
+                  "mysql"
+                else
+                  "mariadb"
+                end
 
-service "mysql" do
+package "#{mysql_variant}-server"
+package "#{mysql_variant}-client"
+
+service "#{mysql_variant}" do
   action [:enable, :start]
   supports :status => true, :restart => true
 end
 
-template "/etc/mysql/mysql.conf.d/zzz-chef.cnf" do
+template "/etc/mysql/#{mysql_variant}.conf.d/zzz-chef.cnf" do
   source "my.cnf.erb"
   owner "root"
   group "root"
   mode "644"
-  notifies :restart, "service[mysql]"
+  notifies :restart, "service[#{mysql_variant}]"
 end
 
 service "apparmor" do
index b0738f997f4e5af73c31abfa8152db8da6695174..88323fe983635123032fb3d13f2de03d2ee285c5 100644 (file)
@@ -3,11 +3,17 @@ require "serverspec"
 # Required by serverspec
 set :backend, :exec
 
-describe package("mysql-server") do
+mysql_variant = if os[:family] == "ubuntu"
+                  "mysql"
+                else
+                  "mariadb"
+                end
+
+describe package("#{mysql_variant}-server") do
   it { should be_installed }
 end
 
-describe service("mysql") do
+describe service("#{mysql_variant}") do
   it { should be_enabled }
   it { should be_running }
 end
index b0738f997f4e5af73c31abfa8152db8da6695174..88323fe983635123032fb3d13f2de03d2ee285c5 100644 (file)
@@ -3,11 +3,17 @@ require "serverspec"
 # Required by serverspec
 set :backend, :exec
 
-describe package("mysql-server") do
+mysql_variant = if os[:family] == "ubuntu"
+                  "mysql"
+                else
+                  "mariadb"
+                end
+
+describe package("#{mysql_variant}-server") do
   it { should be_installed }
 end
 
-describe service("mysql") do
+describe service("#{mysql_variant}") do
   it { should be_enabled }
   it { should be_running }
 end