changeset 23:aa40b53324e4 puppet-3.6

Make MySQL Website class more flexible for supporting MariaDB
author IBBoard <dev@ibboard.co.uk>
date Sun, 08 Mar 2015 23:58:22 +0000
parents ccca5d75111f
children 204330fea19a
files modules/website/manifests/mysql.pp
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/modules/website/manifests/mysql.pp	Sun Mar 08 23:57:04 2015 +0000
+++ b/modules/website/manifests/mysql.pp	Sun Mar 08 23:58:22 2015 +0000
@@ -3,10 +3,11 @@
   $mysqlpassword,
   $mysqlsuffix    = '',
   $phpsuffix      = '',
-  $phpmysqlsuffix = '')
+  $phpmysqlsuffix = '',
+  $mysqlprefix    = 'mysql')
   {
   class { 'mysql::client':
-    package_name    => "mysql${mysqlsuffix}",
+    package_name    => "${mysqlprefix}${mysqlsuffix}",
     bindings_enable => false, #Deal with bindings manually
   }
   class { 'mysql::bindings':
@@ -14,7 +15,7 @@
     php_package_name => "php${phpsuffix}-mysql${phpmysqlsuffix}",
   }
   class { 'mysql::server':
-    package_name => "mysql${mysqlsuffix}-server",
+    package_name => "${mysqlprefix}${mysqlsuffix}-server",
     override_options => {
       'mysqld' => {
         'query_cache_size' => '32M',
@@ -25,12 +26,12 @@
         'log-queries-not-using-indexes' => '1',
       }
     },
-    require => File['/var/log/mysql/']
   }
   file { '/var/log/mysql':
     ensure => directory,
     owner => 'mysql',
     group => 'mysql',
+    require => Class['mysql::server'],
   }
   $username = strip($mysqluser)
   $password = strip($mysqlpassword)
@@ -38,6 +39,7 @@
   exec { 'Rename root MySQL user for security':
     command  => "mysql -uroot -e 'UPDATE mysql.user SET User = \"$username\", Password = PASSWORD(\"$password\") WHERE User = \"root\"; DELETE FROM mysql.user WHERE User = ''; FLUSH PRIVILEGES;' && touch $configured_marker",
     provider => shell,
-    creates  => $configured_marker
+    creates  => $configured_marker,
+    require  => Class['mysql::server'],
   }
 }