Mercurial > repos > other > Puppet
diff modules/mysql/manifests/params.pp @ 389:668df4711671
Update MySQL modules
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 03 Jan 2022 17:16:21 +0000 |
parents | 48d3a1948e4d |
children | c6c9a2cfcfbd |
line wrap: on
line diff
--- a/modules/mysql/manifests/params.pp Mon Jan 03 17:15:14 2022 +0000 +++ b/modules/mysql/manifests/params.pp Mon Jan 03 17:16:21 2022 +0000 @@ -4,8 +4,8 @@ # @api private # class mysql::params { - $manage_config_file = true + $config_file_mode = '0644' $purge_conf_dir = false $restart = false $root_password = 'UNSET' @@ -37,8 +37,7 @@ $client_dev_package_provider = undef $daemon_dev_package_ensure = 'present' $daemon_dev_package_provider = undef - $xtrabackup_package_name = 'percona-xtrabackup' - + $xtrabackup_package_name_default = 'percona-xtrabackup' case $::osfamily { 'RedHat': { @@ -51,12 +50,23 @@ } $python_package_name = 'MySQL-python' } - /^(RedHat|CentOS|Scientific|OracleLinux)$/: { - if versioncmp($::operatingsystemmajrelease, '7') >= 0 { + 'Amazon': { + if versioncmp($::operatingsystemrelease, '2') >= 0 { $provider = 'mariadb' } else { $provider = 'mysql' } + } + /^(RedHat|Rocky|CentOS|Scientific|OracleLinux)$/: { + if versioncmp($::operatingsystemmajrelease, '7') >= 0 { + $provider = 'mariadb' + if versioncmp($::operatingsystemmajrelease, '8') >= 0 { + $xtrabackup_package_name_override = 'percona-xtrabackup-24' + } + } else { + $provider = 'mysql' + $xtrabackup_package_name_override = 'percona-xtrabackup-20' + } if versioncmp($::operatingsystemmajrelease, '8') >= 0 { $java_package_name = 'mariadb-java-client' $python_package_name = 'python3-PyMySQL' @@ -95,11 +105,14 @@ $datadir = '/var/lib/mysql' $root_group = 'root' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $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' + $managed_dirs = undef # mysql::bindings $perl_package_name = 'perl-DBD-MySQL' $php_package_name = 'php-mysql' @@ -110,80 +123,57 @@ 'Suse': { case $::operatingsystem { 'OpenSuSE': { - if versioncmp( $::operatingsystemmajrelease, '12' ) >= 0 { - $client_package_name = 'mariadb-client' - $server_package_name = 'mariadb' - # First service start fails if this is set. Runs fine without - # it being set, in any case. Leaving it as-is for the mysql. - $basedir = undef - } else { - $client_package_name = 'mysql-community-server-client' - $server_package_name = 'mysql-community-server' - $basedir = '/usr' - } + $socket = '/var/run/mysql/mysql.sock' + $log_error = '/var/log/mysql/mysqld.log' + $pidfile = '/var/run/mysql/mysqld.pid' + $ruby_package_name = 'rubygem-mysql' + $client_package_name = 'mariadb-client' + $server_package_name = 'mariadb' + # First service start fails if this is set. Runs fine without + # it being set, in any case. Leaving it as-is for the mysql. + $basedir = undef } 'SLES','SLED': { - if versioncmp($::operatingsystemrelease, '12') >= 0 { - $client_package_name = 'mariadb-client' - $server_package_name = 'mariadb' - $basedir = undef - } else { - $client_package_name = 'mysql-client' - $server_package_name = 'mysql' - $basedir = '/usr' - } + $socket = '/run/mysql/mysql.sock' + $log_error = '/var/log/mysqld.log' + $pidfile = '/var/lib/mysql/mysqld.pid' + $ruby_package_name = 'ruby-mysql' + $client_package_name = 'mariadb-client' + $server_package_name = 'mariadb' + $basedir = undef } default: { - fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{os}.', - {'module_name' => $module_name, 'os' => $::operatingsystem })) + fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${::operatingsystem}.") } } $config_file = '/etc/my.cnf' $includedir = '/etc/my.cnf.d' $datadir = '/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' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $server_service_name = 'mysql' - - if $::operatingsystem =~ /(SLES|SLED)/ { - if versioncmp( $::operatingsystemmajrelease, '12' ) >= 0 { - $socket = '/run/mysql/mysql.sock' - } else { - $socket = '/var/lib/mysql/mysql.sock' - } - } else { - $socket = '/var/run/mysql/mysql.sock' - } + $xtrabackup_package_name_override = 'xtrabackup' $ssl_ca = '/etc/mysql/cacert.pem' $ssl_cert = '/etc/mysql/server-cert.pem' $ssl_key = '/etc/mysql/server-key.pem' $tmpdir = '/tmp' + $managed_dirs = undef # mysql::bindings $java_package_name = 'mysql-connector-java' $perl_package_name = 'perl-DBD-mysql' $php_package_name = 'apache2-mod_php53' $python_package_name = 'python-mysql' - $ruby_package_name = $::operatingsystem ? { - /OpenSuSE/ => 'rubygem-mysql', - /(SLES|SLED)/ => 'ruby-mysql', - } $client_dev_package_name = 'libmysqlclient-devel' $daemon_dev_package_name = 'mysql-devel' } 'Debian': { - if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0 { + if $::operatingsystem == 'Debian' { $provider = 'mariadb' - } else { + } else { # Ubuntu $provider = 'mysql' } if $provider == 'mariadb' { @@ -208,34 +198,48 @@ $pidfile = '/var/run/mysqld/mysqld.pid' $root_group = 'root' $mysql_group = 'adm' + $mycnf_owner = undef + $mycnf_group = undef $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' + $managed_dirs = ['tmpdir','basedir','datadir','innodb_data_home_dir','innodb_log_group_home_dir','innodb_undo_directory','innodb_tmpdir'] + # mysql::bindings - if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') >= 0 { + if ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') >= 0) or + ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) { $java_package_name = 'libmariadb-java' } else { $java_package_name = 'libmysql-java' } $perl_package_name = 'libdbd-mysql-perl' if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0) or - ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0) { + ($::operatingsystem == 'Debian') { $php_package_name = 'php-mysql' } else { $php_package_name = 'php5-mysql' } + if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or + ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or + ($::operatingsystem == 'Debian') { + $xtrabackup_package_name_override = 'percona-xtrabackup-24' + } + if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or + ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '11') >= 0){ + $python_package_name = 'python3-mysqldb' + } else { + $python_package_name = 'python-mysqldb' + } - $python_package_name = 'python-mysqldb' - $ruby_package_name = $::lsbdistcodename ? { - 'jessie' => 'ruby-mysql', - 'stretch' => 'ruby-mysql2', - 'buster' => 'ruby-mysql2', - 'trusty' => 'ruby-mysql', - 'xenial' => 'ruby-mysql', - 'bionic' => 'ruby-mysql2', - default => 'libmysql-ruby', + $ruby_package_name = $facts['os']['release']['major'] ? { + '9' => 'ruby-mysql2', # stretch + '10' => 'ruby-mysql2', # buster + '16.04' => 'ruby-mysql', # xenial + '18.04' => 'ruby-mysql2', # bionic + '20.04' => 'ruby-mysql2', # focal + default => 'libmysql-ruby', } } @@ -252,12 +256,15 @@ $pidfile = '/var/run/mysqld/mysqld.pid' $root_group = 'root' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $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' + $managed_dirs = undef # mysql::bindings $java_package_name = 'mysql-connector-java' $perl_package_name = 'perl-dbd-mysql' @@ -277,12 +284,15 @@ $pidfile = '/run/mysqld/mysqld.pid' $root_group = 'root' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $server_service_name = 'mysql' $socket = '/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' + $managed_dirs = undef # mysql::bindings $java_package_name = 'dev-java/jdbc-mysql' $perl_package_name = 'dev-perl/DBD-mysql' @@ -292,8 +302,8 @@ } 'FreeBSD': { - $client_package_name = 'databases/mysql56-client' - $server_package_name = 'databases/mysql56-server' + $client_package_name = 'databases/mysql57-client' + $server_package_name = 'databases/mysql57-server' $basedir = '/usr/local' $config_file = '/usr/local/etc/my.cnf' $includedir = '/usr/local/etc/my.cnf.d' @@ -302,12 +312,15 @@ $pidfile = '/var/run/mysql.pid' $root_group = 'wheel' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $server_service_name = 'mysql-server' $socket = '/var/db/mysql/mysql.sock' $ssl_ca = undef $ssl_cert = undef $ssl_key = undef $tmpdir = '/tmp' + $managed_dirs = undef # mysql::bindings $java_package_name = 'databases/mysql-connector-java' $perl_package_name = 'p5-DBD-mysql' @@ -330,12 +343,15 @@ $pidfile = '/var/mysql/mysql.pid' $root_group = 'wheel' $mysql_group = '_mysql' + $mycnf_owner = undef + $mycnf_group = undef $server_service_name = 'mysqld' $socket = '/var/run/mysql/mysql.sock' $ssl_ca = undef $ssl_cert = undef $ssl_key = undef $tmpdir = '/tmp' + $managed_dirs = undef # mysql::bindings $java_package_name = undef $perl_package_name = 'p5-DBD-mysql' @@ -362,6 +378,7 @@ $ssl_cert = undef $ssl_key = undef $tmpdir = '/tmp' + $managed_dirs = undef # mysql::bindings $java_package_name = undef $perl_package_name = undef @@ -385,12 +402,15 @@ $pidfile = '/run/mysqld/mysqld.pid' $root_group = 'root' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $server_service_name = 'mariadb' $socket = '/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' + $managed_dirs = undef $java_package_name = undef $perl_package_name = 'perl-dbd-mysql' $php_package_name = 'php7-mysqlnd' @@ -410,12 +430,15 @@ $pidfile = '/var/run/mysqld/mysqld.pid' $root_group = 'root' $mysql_group = 'mysql' + $mycnf_owner = undef + $mycnf_group = undef $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' + $managed_dirs = undef # mysql::bindings $java_package_name = 'mysql-connector-java' $perl_package_name = 'perl-DBD-MySQL' @@ -428,8 +451,7 @@ } default: { - fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{osfamily} or %{os}.', - {'module_name' => $module_name, 'os' => $::operatingsystem, 'osfamily' => $::osfamily})) + fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${::osfamily} or ${::operatingsystem}.") } } } @@ -437,17 +459,14 @@ case $::operatingsystem { 'Ubuntu': { - # lint:ignore:only_variable_string - if versioncmp("${::operatingsystemmajrelease}", '14.10') > 0 { - # lint:endignore - $server_service_provider = 'systemd' - } else { - $server_service_provider = 'upstart' - } + $server_service_provider = 'systemd' } 'Alpine': { $server_service_provider = 'rc-service' } + 'FreeBSD': { + $server_service_provider = 'freebsd' + } default: { $server_service_provider = undef } @@ -518,8 +537,14 @@ }, } + if defined('$xtrabackup_package_name_override') { + $xtrabackup_package_name = pick($xtrabackup_package_name_override, $xtrabackup_package_name_default) + } else { + $xtrabackup_package_name = $xtrabackup_package_name_default + } + ## Additional graceful failures if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '4' and $::operatingsystem != 'Amazon' { - fail(translate('Unsupported platform: puppetlabs-%{module_name} only supports RedHat 5.0 and beyond.', {'module_name' => $module_name})) + fail("Unsupported platform: puppetlabs-${module_name} only supports RedHat 6.0 and beyond.") } }