
Only install the max_connections config file for the mysql server if we are installing the mysql server. Change-Id: I0c9beb54d3e6982fc4c1b4de8ce1f81eb40c654d
60 lines
1.6 KiB
Puppet
60 lines
1.6 KiB
Puppet
# == Class: nodepool::mysql
|
|
#
|
|
class nodepool::mysql (
|
|
$mysql_password,
|
|
$mysql_root_password,
|
|
$mysql_bind_address = '127.0.0.1',
|
|
$mysql_default_engine = 'InnoDB',
|
|
$mysql_db_name = 'nodepool',
|
|
$mysql_max_connections = 8192,
|
|
$mysql_user_host = 'localhost',
|
|
$mysql_user_name = 'nodepool',
|
|
) {
|
|
|
|
$mysql_data = load_module_metadata('mysql', true)
|
|
if ($mysql_data == {}) {
|
|
class { '::mysql::server' :
|
|
config_hash => {
|
|
'bind_address' => $mysql_bind_address,
|
|
'default_engine' => $mysql_default_engine,
|
|
'max_connections' => $mysql_max_connections,
|
|
'root_password' => $mysql_root_password,
|
|
}
|
|
}
|
|
} else { # If it has metadata.json, assume it's new enough to use this interface
|
|
class { '::mysql::server' :
|
|
override_options => {
|
|
'mysqld' => {
|
|
'default-storage-engine' => $mysql_default_engine,
|
|
'max_connections' => $mysql_max_connections,
|
|
}
|
|
},
|
|
root_password => $mysql_root_password,
|
|
}
|
|
}
|
|
|
|
include ::mysql::server::account_security
|
|
|
|
mysql::db { $mysql_db_name :
|
|
user => $mysql_user_name,
|
|
password => $mysql_password,
|
|
host => $mysql_user_host,
|
|
grant => ['all'],
|
|
charset => 'utf8',
|
|
require => [
|
|
Class['mysql::server'],
|
|
Class['mysql::server::account_security'],
|
|
],
|
|
}
|
|
|
|
file { '/etc/mysql/conf.d/max_connections.cnf':
|
|
ensure => present,
|
|
content => "[server]\nmax_connections = 8192\n",
|
|
mode => '0444',
|
|
owner => 'root',
|
|
group => 'root',
|
|
require => Class['mysql::server'],
|
|
}
|
|
|
|
}
|