2013-09-13 19:09:48 +02:00
# Private class : See README. md.
class mysql: : params {
$ manage_config_file = true
$ old_root_password = ''
$ purge_conf_dir = false
$ restart = false
$ root_password = 'UNSET'
$ server_package_ensure = 'present'
$ server_service_manage = true
$ server_service_enabled = true
2014-06-04 01:45:00 +02:00
$c lient_package_ensure = 'present'
2013-09-13 19:09:48 +02:00
# mysql: : bindings
2014-05-09 03:17:44 +02:00
$b indings_enable = false
$ java_package_ensure = 'present'
$ java_package_provider = undef
$ perl_package_ensure = 'present'
$ perl_package_provider = undef
$ php_package_ensure = 'present'
$ php_package_provider = undef
$ python_package_ensure = 'present'
$ python_package_provider = undef
$ ruby_package_ensure = 'present'
$ ruby_package_provider = undef
$c lient_dev_package_ensure = 'present'
$c lient_dev_package_provider = undef
$dae mon_dev_package_ensure = 'present'
$dae mon_dev_package_provider = undef
2013-09-13 19:09:48 +02:00
case $ : : osfamily {
'RedHat' : {
2014-01-24 16:14:58 +01:00
case $ : : operatingsystem {
'Fedora' : {
2014-06-04 10:07:05 +02:00
if is_integer( $ : : operatingsystemrelease) and $ : : operatingsystemrelease > = 1 9 or $ : : operatingsystemrelease = = 'Rawhide' {
2014-01-24 16:14:58 +01:00
$ provider = 'mariadb'
} else {
$ provider = 'mysql'
}
}
'RedHat' : {
if $ : : operatingsystemrelease > = 7 {
$ provider = 'mariadb'
} else {
$ provider = 'mysql'
}
}
default : {
$ provider = 'mysql'
}
}
if $ provider = = 'mariadb' {
2013-09-13 19:09:48 +02:00
$c lient_package_name = 'mariadb'
$ server_package_name = 'mariadb-server'
2014-01-24 16:14:58 +01:00
$ server_service_name = 'mariadb'
$ log_error = '/var/log/mariadb/mariadb.log'
2014-05-09 21:10:27 +02:00
$c onfig_file = '/etc/my.cnf'
2014-01-24 16:14:58 +01:00
$ pidfile = '/var/run/mariadb/mariadb.pid'
2013-09-13 19:09:48 +02:00
} else {
$c lient_package_name = 'mysql'
$ server_package_name = 'mysql-server'
2014-01-24 16:14:58 +01:00
$ server_service_name = 'mysqld'
$ log_error = '/var/log/mysqld.log'
$c onfig_file = '/etc/my.cnf'
$ pidfile = '/var/run/mysqld/mysqld.pid'
2013-09-13 19:09:48 +02:00
}
2014-01-24 16:14:58 +01:00
2014-05-09 03:17:44 +02:00
$ba sedir = '/usr'
$da tadir = '/var/lib/mysql'
$ root_group = 'root'
$ socket = '/var/lib/mysql/mysql.sock'
$ ssl_ca = '/etc/mysql/cacert.pem'
$ ssl_cert = '/etc/mysql/server-cert.pem'
$ ssl_key = '/etc/mysql/server-key.pem'
$ tmpdir = '/tmp'
2013-09-13 19:09:48 +02:00
# mysql: : bindings
2014-05-09 03:17:44 +02:00
$ java_package_name = 'mysql-connector-java'
$ perl_package_name = 'perl-DBD-MySQL'
$ php_package_name = 'php-mysql'
$ python_package_name = 'MySQL-python'
$ ruby_package_name = 'ruby-mysql'
$c lient_dev_package_name = 'libmysqlclient-devel'
$dae mon_dev_package_name = 'mysql-devel'
2013-09-13 19:09:48 +02:00
}
'Suse' : {
$c lient_package_name = $ : : operatingsystem ? {
/ OpenSuSE/ = > 'mysql-community-server-client' ,
/ ( SLES| SLED) / = > 'mysql-client' ,
}
$ server_package_name = $ : : operatingsystem ? {
/ OpenSuSE/ = > 'mysql-community-server' ,
/ ( SLES| SLED) / = > 'mysql' ,
}
$ba sedir = '/usr'
$c onfig_file = '/etc/my.cnf'
$da tadir = '/var/lib/mysql'
$ log_error = $ : : operatingsystem ? {
/ OpenSuSE/ = > '/var/log/mysql/mysqld.log' ,
/ ( SLES| SLED) / = > '/var/log/mysqld.log' ,
}
$ pidfile = $ : : operatingsystem ? {
/ OpenSuSE/ = > '/var/run/mysql/mysqld.pid' ,
/ ( SLES| SLED) / = > '/var/lib/mysql/mysqld.pid' ,
}
$ root_group = 'root'
$ server_service_name = 'mysql'
$ socket = $ : : operatingsystem ? {
/ OpenSuSE/ = > '/var/run/mysql/mysql.sock' ,
/ ( SLES| SLED) / = > '/var/lib/mysql/mysql.sock' ,
}
$ ssl_ca = '/etc/mysql/cacert.pem'
$ ssl_cert = '/etc/mysql/server-cert.pem'
$ ssl_key = '/etc/mysql/server-key.pem'
$ tmpdir = '/tmp'
# mysql: : bindings
$ java_package_name = 'mysql-connector-java'
$ perl_package_name = 'perl-DBD-mysql'
2014-02-26 15:54:54 +01:00
$ php_package_name = 'apache2-mod_php53'
2013-09-13 19:09:48 +02:00
$ python_package_name = 'python-mysql'
$ ruby_package_name = $ : : operatingsystem ? {
/ OpenSuSE/ = > 'rubygem-mysql' ,
/ ( SLES| SLED) / = > 'ruby-mysql' ,
}
2014-05-09 03:17:44 +02:00
$c lient_dev_package_name = 'libmysqlclient-devel'
$dae mon_dev_package_name = 'mysql-devel'
2013-09-13 19:09:48 +02:00
}
'Debian' : {
2014-05-09 03:17:44 +02:00
$c lient_package_name = 'mysql-client'
$ server_package_name = 'mysql-server'
2013-09-13 19:09:48 +02:00
2014-05-09 03:17:44 +02:00
$ba sedir = '/usr'
$c onfig_file = '/etc/mysql/my.cnf'
$da tadir = '/var/lib/mysql'
$ log_error = '/var/log/mysql/error.log'
$ pidfile = '/var/run/mysqld/mysqld.pid'
$ root_group = 'root'
$ server_service_name = 'mysql'
$ socket = '/var/run/mysqld/mysqld.sock'
$ ssl_ca = '/etc/mysql/cacert.pem'
$ ssl_cert = '/etc/mysql/server-cert.pem'
$ ssl_key = '/etc/mysql/server-key.pem'
$ tmpdir = '/tmp'
2013-09-13 19:09:48 +02:00
# mysql: : bindings
$ java_package_name = 'libmysql-java'
$ perl_package_name = 'libdbd-mysql-perl'
$ php_package_name = 'php5-mysql'
$ python_package_name = 'python-mysqldb'
2014-05-09 22:46:03 +02:00
$ ruby_package_name = $ : : lsbdistcodename ? {
'trusty' = > 'ruby-mysql' ,
default = > 'libmysql-ruby' ,
}
2014-05-09 03:17:44 +02:00
$c lient_dev_package_name = 'libmysqlclient-dev'
$dae mon_dev_package_name = 'mysqld-dev'
2013-09-13 19:09:48 +02:00
}
'FreeBSD' : {
$c lient_package_name = 'databases/mysql55-client'
$ server_package_name = 'databases/mysql55-server'
$ba sedir = '/usr/local'
$c onfig_file = '/var/db/mysql/my.cnf'
$da tadir = '/var/db/mysql'
$ log_error = "/var/db/mysql/${::hostname}.err"
$ pidfile = '/var/db/mysql/mysql.pid'
$ root_group = 'wheel'
$ server_service_name = 'mysql-server'
$ socket = '/tmp/mysql.sock'
$ ssl_ca = undef
$ ssl_cert = undef
$ ssl_key = undef
$ tmpdir = '/tmp'
# mysql: : bindings
$ java_package_name = 'databases/mysql-connector-java'
$ perl_package_name = 'p5-DBD-mysql'
$ php_package_name = 'php5-mysql'
$ python_package_name = 'databases/py-MySQLdb'
$ ruby_package_name = 'databases/ruby-mysql'
2014-05-09 03:17:44 +02:00
# The libraries installed by these packages are included in client and server packages, no installation required.
$c lient_dev_package_name = undef
$dae mon_dev_package_name = undef
2013-09-13 19:09:48 +02:00
}
default : {
case $ : : operatingsystem {
'Amazon' : {
$c lient_package_name = 'mysql'
$ server_package_name = 'mysql-server'
$ba sedir = '/usr'
$c onfig_file = '/etc/my.cnf'
$da tadir = '/var/lib/mysql'
$ log_error = '/var/log/mysqld.log'
$ pidfile = '/var/run/mysqld/mysqld.pid'
$ root_group = 'root'
$ server_service_name = 'mysqld'
$ socket = '/var/lib/mysql/mysql.sock'
$ ssl_ca = '/etc/mysql/cacert.pem'
$ ssl_cert = '/etc/mysql/server-cert.pem'
$ ssl_key = '/etc/mysql/server-key.pem'
$ tmpdir = '/tmp'
# mysql: : bindings
$ java_package_name = 'mysql-connector-java'
$ perl_package_name = 'perl-DBD-MySQL'
$ php_package_name = 'php-mysql'
$ python_package_name = 'MySQL-python'
$ ruby_package_name = 'ruby-mysql'
2014-05-09 03:17:44 +02:00
# The libraries installed by these packages are included in client and server packages, no installation required.
$c lient_dev_package_name = undef
$dae mon_dev_package_name = undef
2013-09-13 19:09:48 +02:00
}
default : {
fail( "Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat, Debian, and FreeBSD, or operatingsystem Amazon" )
}
}
}
}
2013-09-25 00:04:29 +02:00
case $ : : operatingsystem {
'Ubuntu' : {
2014-01-23 21:54:07 +01:00
$ server_service_provider = upstart
2013-09-25 00:04:29 +02:00
}
default : {
2014-01-23 21:54:07 +01:00
$ server_service_provider = undef
2013-09-25 00:04:29 +02:00
}
}
$defa ult_options = {
'client' = > {
'port' = > '3306' ,
'socket' = > $ mysql: : params: : socket,
} ,
'mysqld_safe' = > {
'nice' = > '0' ,
2013-12-13 22:20:50 +01:00
'log-error' = > $ mysql: : params: : log_error,
2013-09-25 00:04:29 +02:00
'socket' = > $ mysql: : params: : socket,
} ,
'mysqld' = > {
'basedir' = > $ mysql: : params: : basedir,
2013-12-14 21:55:33 +01:00
'bind-address' = > '127.0.0.1' ,
2013-09-25 00:04:29 +02:00
'datadir' = > $ mysql: : params: : datadir,
'expire_logs_days' = > '10' ,
2013-12-14 23:15:13 +01:00
'key_buffer_size' = > '16M' ,
2013-12-13 22:20:50 +01:00
'log-error' = > $ mysql: : params: : log_error,
2013-09-25 00:04:29 +02:00
'max_allowed_packet' = > '16M' ,
'max_binlog_size' = > '100M' ,
'max_connections' = > '151' ,
'myisam_recover' = > 'BACKUP' ,
2013-12-13 22:20:50 +01:00
'pid-file' = > $ mysql: : params: : pidfile,
2013-09-25 00:04:29 +02:00
'port' = > '3306' ,
'query_cache_limit' = > '1M' ,
'query_cache_size' = > '16M' ,
'skip-external-locking' = > true ,
'socket' = > $ mysql: : params: : socket,
'ssl' = > false ,
'ssl-ca' = > $ mysql: : params: : ssl_ca,
'ssl-cert' = > $ mysql: : params: : ssl_cert,
'ssl-key' = > $ mysql: : params: : ssl_key,
2014-02-28 19:07:48 +01:00
'ssl-disable' = > false ,
2013-09-25 00:04:29 +02:00
'thread_cache_size' = > '8' ,
'thread_stack' = > '256K' ,
'tmpdir' = > $ mysql: : params: : tmpdir,
'user' = > 'mysql' ,
} ,
'mysqldump' = > {
2013-09-30 18:10:42 +02:00
'max_allowed_packet' = > '16M' ,
2013-09-25 00:04:29 +02:00
'quick' = > true ,
'quote-names' = > true ,
} ,
'isamchk' = > {
2013-12-14 23:15:13 +01:00
'key_buffer_size' = > '16M' ,
2013-09-25 00:04:29 +02:00
} ,
}
2013-09-13 19:09:48 +02:00
}