diff --git a/deployment/puppet/mysql/manifests/config.pp b/deployment/puppet/mysql/manifests/config.pp index fc98efe66b..e692121133 100644 --- a/deployment/puppet/mysql/manifests/config.pp +++ b/deployment/puppet/mysql/manifests/config.pp @@ -38,6 +38,7 @@ class mysql::config( $service_name = $mysql::params::service_name, $config_file = $mysql::params::config_file, $socket = $mysql::params::socket, + $pidfile = $mysql::params::pidfile, $datadir = $mysql::params::datadir, $ssl = $mysql::params::ssl, $ssl_ca = $mysql::params::ssl_ca, @@ -106,14 +107,14 @@ class mysql::config( } } - file { '/etc/mysql': - ensure => directory, - mode => '0755', - } - file { '/etc/mysql/conf.d': - ensure => directory, - mode => '0755', - } +# file { '/etc/mysql': +# ensure => directory, +# mode => '0755', +# } +# file { '/etc/mysql/conf.d': +# ensure => directory, +# mode => '0755', +# } file { $config_file: content => template('mysql/my.cnf.erb'), mode => '0644', diff --git a/deployment/puppet/mysql/manifests/params.pp b/deployment/puppet/mysql/manifests/params.pp index 1cec72fc43..1d3bf7c360 100644 --- a/deployment/puppet/mysql/manifests/params.pp +++ b/deployment/puppet/mysql/manifests/params.pp @@ -34,6 +34,7 @@ class mysql::params { $client_package_name = 'mysql' $server_package_name = 'mysql-server' $socket = '/var/lib/mysql/mysql.sock' + $pidfile = '/var/run/mysqld/mysqld.pid' $config_file = '/etc/my.cnf' $log_error = '/var/log/mysqld.log' $ruby_package_name = 'ruby-mysql' @@ -53,6 +54,7 @@ class mysql::params { $client_package_name = 'mysql-client' $server_package_name = 'mysql-server' $socket = '/var/run/mysqld/mysqld.sock' + $pidfile = '/var/run/mysqld/mysqld.pid' $config_file = '/etc/mysql/my.cnf' $log_error = '/var/log/mysql/error.log' $ruby_package_name = 'libmysql-ruby' @@ -71,6 +73,7 @@ class mysql::params { $client_package_name = 'databases/mysql55-client' $server_package_name = 'databases/mysql55-server' $socket = '/tmp/mysql.sock' + $pidfile = '/var/db/mysql/mysql.pid' $config_file = '/var/db/mysql/my.cnf' $log_error = "/var/db/mysql/${::hostname}.err" $ruby_package_name = 'ruby-mysql' diff --git a/deployment/puppet/mysql/manifests/server.pp b/deployment/puppet/mysql/manifests/server.pp index 1f711d434a..a81ef47124 100644 --- a/deployment/puppet/mysql/manifests/server.pp +++ b/deployment/puppet/mysql/manifests/server.pp @@ -15,6 +15,7 @@ # Sample Usage: # class mysql::server ( + $custom_setup_class = undef, $package_name = $mysql::params::server_package_name, $package_ensure = 'present', $service_name = $mysql::params::service_name, @@ -22,31 +23,25 @@ class mysql::server ( $config_hash = {}, $enabled = true ) inherits mysql::params { - + Class['mysql::server'] -> Class['mysql::config'] - $config_class = {} - $config_class['mysql::config'] = $config_hash + create_resources( 'class', { 'mysql::config' => $config_hash } ) - create_resources( 'class', $config_class ) - - package { 'mysql-server': - name => $package_name, - ensure => $package_ensure, - } - - if $enabled { - $service_ensure = 'running' + if ($custom_setup_class == undef) { + package { 'mysql-server': + name => $package_name, + ensure => $package_ensure, + } + + service { 'mysqld': + name => $service_name, + ensure => $enabled ? { true => 'running', default => 'stopped' }, + enable => $enabled, + require => Package['mysql-server'], + provider => $service_provider, + } } else { - $service_ensure = 'stopped' + require($custom_setup_class) } - - service { 'mysqld': - name => $service_name, - ensure => $service_ensure, - enable => $enabled, - require => Package['mysql-server'], - provider => $service_provider, - } - } diff --git a/deployment/puppet/mysql/templates/my.cnf.erb b/deployment/puppet/mysql/templates/my.cnf.erb index e09c7c94f7..774aad03b1 100644 --- a/deployment/puppet/mysql/templates/my.cnf.erb +++ b/deployment/puppet/mysql/templates/my.cnf.erb @@ -6,6 +6,7 @@ socket = <%= socket %> nice = 0 [mysqld] user = mysql +pid-file = /var/run/mysqld/mysqld.pid socket = <%= socket %> port = <%= port %> basedir = <%= basedir %>