(#14330) Add support for FreeBSD
Note: ssl_ca, ssl_cert, and ssl_key do not have sane defaults in FreeBSD. Setting ssl to true will require setting the parameters mentioned above.
This commit is contained in:
parent
ece11c57fa
commit
05d7e23fe8
4 changed files with 54 additions and 13 deletions
|
@ -44,16 +44,29 @@ class mysql::config(
|
|||
$ssl_cert = $mysql::params::ssl_cert,
|
||||
$ssl_key = $mysql::params::ssl_key,
|
||||
$log_error = $mysql::params::log_error,
|
||||
$default_engine = 'UNSET'
|
||||
$default_engine = 'UNSET',
|
||||
$root_group = $mysql::params::root_group
|
||||
) inherits mysql::params {
|
||||
|
||||
File {
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
group => $root_group,
|
||||
mode => '0400',
|
||||
notify => Exec['mysqld-restart'],
|
||||
}
|
||||
|
||||
if $ssl and $ssl_ca == undef {
|
||||
fail('The ssl_ca parameter is required when ssl is true')
|
||||
}
|
||||
|
||||
if $ssl and $ssl_cert == undef {
|
||||
fail('The ssl_cert parameter is required when ssl is true')
|
||||
}
|
||||
|
||||
if $ssl and $ssl_key == undef {
|
||||
fail('The ssl_key parameter is required when ssl is true')
|
||||
}
|
||||
|
||||
# This kind of sucks, that I have to specify a difference resource for
|
||||
# restart. the reason is that I need the service to be started before mods
|
||||
# to the config file which can cause a refresh
|
||||
|
@ -75,7 +88,7 @@ class mysql::config(
|
|||
command => "mysqladmin -u root ${old_pw} password ${root_password}",
|
||||
logoutput => true,
|
||||
unless => "mysqladmin -u root -p${root_password} status > /dev/null",
|
||||
path => '/usr/local/sbin:/usr/bin',
|
||||
path => '/usr/local/sbin:/usr/bin:/usr/local/bin',
|
||||
notify => Exec['mysqld-restart'],
|
||||
require => File['/etc/mysql/conf.d'],
|
||||
}
|
||||
|
|
|
@ -14,13 +14,8 @@ class mysql::params {
|
|||
|
||||
$bind_address = '127.0.0.1'
|
||||
$port = 3306
|
||||
$server_package_name = 'mysql-server'
|
||||
$etc_root_password = false
|
||||
$datadir = '/var/lib/mysql'
|
||||
$ssl = false
|
||||
$ssl_ca = '/etc/mysql/cacert.pem'
|
||||
$ssl_cert = '/etc/mysql/server-cert.pem'
|
||||
$ssl_key = '/etc/mysql/server-key.pem'
|
||||
|
||||
case $::operatingsystem {
|
||||
"Ubuntu": {
|
||||
|
@ -33,8 +28,11 @@ class mysql::params {
|
|||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
$basedir = '/usr'
|
||||
$datadir = '/var/lib/mysql'
|
||||
$service_name = 'mysqld'
|
||||
$client_package_name = 'mysql'
|
||||
$server_package_name = 'mysql-server'
|
||||
$socket = '/var/lib/mysql/mysql.sock'
|
||||
$config_file = '/etc/my.cnf'
|
||||
$log_error = '/var/log/mysqld.log'
|
||||
|
@ -42,21 +40,51 @@ class mysql::params {
|
|||
$ruby_package_provider = 'gem'
|
||||
$python_package_name = 'MySQL-python'
|
||||
$java_package_name = 'mysql-connector-java'
|
||||
$root_group = 'root'
|
||||
$ssl_ca = '/etc/mysql/cacert.pem'
|
||||
$ssl_cert = '/etc/mysql/server-cert.pem'
|
||||
$ssl_key = '/etc/mysql/server-key.pem'
|
||||
}
|
||||
|
||||
'Debian': {
|
||||
$basedir = '/usr'
|
||||
$datadir = '/var/lib/mysql'
|
||||
$service_name = 'mysql'
|
||||
$client_package_name = 'mysql-client'
|
||||
$server_package_name = 'mysql-server'
|
||||
$socket = '/var/run/mysqld/mysqld.sock'
|
||||
$config_file = '/etc/mysql/my.cnf'
|
||||
$log_error = '/var/log/mysql/error.log'
|
||||
$ruby_package_name = 'libmysql-ruby'
|
||||
$python_package_name = 'python-mysqldb'
|
||||
$java_package_name = 'libmysql-java'
|
||||
$root_group = 'root'
|
||||
$ssl_ca = '/etc/mysql/cacert.pem'
|
||||
$ssl_cert = '/etc/mysql/server-cert.pem'
|
||||
$ssl_key = '/etc/mysql/server-key.pem'
|
||||
}
|
||||
|
||||
'FreeBSD': {
|
||||
$basedir = '/usr/local'
|
||||
$datadir = '/var/db/mysql'
|
||||
$service_name = 'mysql-server'
|
||||
$client_package_name = 'databases/mysql55-client'
|
||||
$server_package_name = 'databases/mysql55-server'
|
||||
$socket = '/tmp/mysql.sock'
|
||||
$config_file = '/var/db/mysql/my.cnf'
|
||||
$log_error = "/var/db/mysql/${::hostname}.err"
|
||||
$ruby_package_name = 'ruby-mysql'
|
||||
$ruby_package_provider = 'gem'
|
||||
$python_package_name = 'databases/py-MySQLdb'
|
||||
$java_package_name = 'databases/mysql-connector-java'
|
||||
$root_group = 'wheel'
|
||||
$ssl_ca = undef
|
||||
$ssl_cert = undef
|
||||
$ssl_key = undef
|
||||
}
|
||||
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat Debian and FreeBSD")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ describe 'mysql::config' do
|
|||
'command' => 'mysqladmin -u root password foo',
|
||||
'logoutput' => true,
|
||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
||||
'path' => '/usr/local/sbin:/usr/bin'
|
||||
'path' => '/usr/local/sbin:/usr/bin:/usr/local/bin'
|
||||
)}
|
||||
|
||||
it { should contain_file('/root/.my.cnf').with(
|
||||
|
@ -67,7 +67,7 @@ describe 'mysql::config' do
|
|||
'command' => 'mysqladmin -u root -pbar password foo',
|
||||
'logoutput' => true,
|
||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
||||
'path' => '/usr/local/sbin:/usr/bin'
|
||||
'path' => '/usr/local/sbin:/usr/bin:/usr/local/bin'
|
||||
)}
|
||||
|
||||
end
|
||||
|
@ -175,7 +175,7 @@ describe 'mysql::config' do
|
|||
'command' => 'mysqladmin -u root -pbar password foo',
|
||||
'logoutput' => true,
|
||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
||||
'path' => '/usr/local/sbin:/usr/bin'
|
||||
'path' => '/usr/local/sbin:/usr/bin:/usr/local/bin'
|
||||
)}
|
||||
|
||||
it { should contain_file('/root/.my.cnf').with(
|
||||
|
|
|
@ -8,7 +8,7 @@ nice = 0
|
|||
user = mysql
|
||||
socket = <%= socket %>
|
||||
port = <%= port %>
|
||||
basedir = /usr
|
||||
basedir = <%= basedir %>
|
||||
datadir = <%= datadir %>
|
||||
tmpdir = /tmp
|
||||
skip-external-locking
|
||||
|
|
Loading…
Reference in a new issue