(#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_cert = $mysql::params::ssl_cert,
|
||||||
$ssl_key = $mysql::params::ssl_key,
|
$ssl_key = $mysql::params::ssl_key,
|
||||||
$log_error = $mysql::params::log_error,
|
$log_error = $mysql::params::log_error,
|
||||||
$default_engine = 'UNSET'
|
$default_engine = 'UNSET',
|
||||||
|
$root_group = $mysql::params::root_group
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
|
||||||
File {
|
File {
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => $root_group,
|
||||||
mode => '0400',
|
mode => '0400',
|
||||||
notify => Exec['mysqld-restart'],
|
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
|
# 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
|
# restart. the reason is that I need the service to be started before mods
|
||||||
# to the config file which can cause a refresh
|
# 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}",
|
command => "mysqladmin -u root ${old_pw} password ${root_password}",
|
||||||
logoutput => true,
|
logoutput => true,
|
||||||
unless => "mysqladmin -u root -p${root_password} status > /dev/null",
|
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'],
|
notify => Exec['mysqld-restart'],
|
||||||
require => File['/etc/mysql/conf.d'],
|
require => File['/etc/mysql/conf.d'],
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,8 @@ class mysql::params {
|
||||||
|
|
||||||
$bind_address = '127.0.0.1'
|
$bind_address = '127.0.0.1'
|
||||||
$port = 3306
|
$port = 3306
|
||||||
$server_package_name = 'mysql-server'
|
|
||||||
$etc_root_password = false
|
$etc_root_password = false
|
||||||
$datadir = '/var/lib/mysql'
|
|
||||||
$ssl = false
|
$ssl = false
|
||||||
$ssl_ca = '/etc/mysql/cacert.pem'
|
|
||||||
$ssl_cert = '/etc/mysql/server-cert.pem'
|
|
||||||
$ssl_key = '/etc/mysql/server-key.pem'
|
|
||||||
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
"Ubuntu": {
|
"Ubuntu": {
|
||||||
|
@ -33,8 +28,11 @@ class mysql::params {
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
|
$basedir = '/usr'
|
||||||
|
$datadir = '/var/lib/mysql'
|
||||||
$service_name = 'mysqld'
|
$service_name = 'mysqld'
|
||||||
$client_package_name = 'mysql'
|
$client_package_name = 'mysql'
|
||||||
|
$server_package_name = 'mysql-server'
|
||||||
$socket = '/var/lib/mysql/mysql.sock'
|
$socket = '/var/lib/mysql/mysql.sock'
|
||||||
$config_file = '/etc/my.cnf'
|
$config_file = '/etc/my.cnf'
|
||||||
$log_error = '/var/log/mysqld.log'
|
$log_error = '/var/log/mysqld.log'
|
||||||
|
@ -42,21 +40,51 @@ class mysql::params {
|
||||||
$ruby_package_provider = 'gem'
|
$ruby_package_provider = 'gem'
|
||||||
$python_package_name = 'MySQL-python'
|
$python_package_name = 'MySQL-python'
|
||||||
$java_package_name = 'mysql-connector-java'
|
$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': {
|
'Debian': {
|
||||||
|
$basedir = '/usr'
|
||||||
|
$datadir = '/var/lib/mysql'
|
||||||
$service_name = 'mysql'
|
$service_name = 'mysql'
|
||||||
$client_package_name = 'mysql-client'
|
$client_package_name = 'mysql-client'
|
||||||
|
$server_package_name = 'mysql-server'
|
||||||
$socket = '/var/run/mysqld/mysqld.sock'
|
$socket = '/var/run/mysqld/mysqld.sock'
|
||||||
$config_file = '/etc/mysql/my.cnf'
|
$config_file = '/etc/mysql/my.cnf'
|
||||||
$log_error = '/var/log/mysql/error.log'
|
$log_error = '/var/log/mysql/error.log'
|
||||||
$ruby_package_name = 'libmysql-ruby'
|
$ruby_package_name = 'libmysql-ruby'
|
||||||
$python_package_name = 'python-mysqldb'
|
$python_package_name = 'python-mysqldb'
|
||||||
$java_package_name = 'libmysql-java'
|
$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: {
|
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',
|
'command' => 'mysqladmin -u root password foo',
|
||||||
'logoutput' => true,
|
'logoutput' => true,
|
||||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
'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(
|
it { should contain_file('/root/.my.cnf').with(
|
||||||
|
@ -67,7 +67,7 @@ describe 'mysql::config' do
|
||||||
'command' => 'mysqladmin -u root -pbar password foo',
|
'command' => 'mysqladmin -u root -pbar password foo',
|
||||||
'logoutput' => true,
|
'logoutput' => true,
|
||||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
||||||
'path' => '/usr/local/sbin:/usr/bin'
|
'path' => '/usr/local/sbin:/usr/bin:/usr/local/bin'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -175,7 +175,7 @@ describe 'mysql::config' do
|
||||||
'command' => 'mysqladmin -u root -pbar password foo',
|
'command' => 'mysqladmin -u root -pbar password foo',
|
||||||
'logoutput' => true,
|
'logoutput' => true,
|
||||||
'unless' => "mysqladmin -u root -pfoo status > /dev/null",
|
'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(
|
it { should contain_file('/root/.my.cnf').with(
|
||||||
|
|
|
@ -8,7 +8,7 @@ nice = 0
|
||||||
user = mysql
|
user = mysql
|
||||||
socket = <%= socket %>
|
socket = <%= socket %>
|
||||||
port = <%= port %>
|
port = <%= port %>
|
||||||
basedir = /usr
|
basedir = <%= basedir %>
|
||||||
datadir = <%= datadir %>
|
datadir = <%= datadir %>
|
||||||
tmpdir = /tmp
|
tmpdir = /tmp
|
||||||
skip-external-locking
|
skip-external-locking
|
||||||
|
|
Loading…
Reference in a new issue