Puppet: Use mariadb on RHEL/CentOS >= 7

refs #9453
This commit is contained in:
Eric Lippmann 2015-07-20 16:47:29 +02:00
parent 2ac27e3325
commit af4dbadd36
2 changed files with 28 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# Class: mysql
#
# This class installs the mysql server and client software.
# This class installs the MySQL server and client software on a RHEL or CentOS
#
# Parameters:
#
@ -16,21 +16,39 @@ class mysql {
Exec { path => '/usr/bin' }
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
$client_package_name = 'mariadb'
$server_package_name = 'mariadb-server'
$server_service_name = 'mariadb'
$cnf = '/etc/my.cnf.d/server.cnf'
$log_error = '/var/log/mariadb/mariadb.log'
$pid_file = '/var/run/mariadb/mariadb.pid'
} else {
$client_package_name = 'mysql'
$server_package_name = 'mysql-server'
$server_service_name = 'mysqld'
$cnf = '/etc/my.cnf'
$log_error = '/var/log/mysqld.log'
$pid_file = '/var/run/mysqld/mysqld.pid'
}
package { [
'mysql', 'mysql-server'
$client_package_name, $server_package_name,
]:
ensure => latest,
}
service { 'mysqld':
ensure => running,
service { $server_service_name:
alias => 'mysqld',
enable => true,
require => Package['mysql-server']
ensure => running,
require => Package[$server_package_name],
}
file { '/etc/my.cnf':
file { $cnf:
content => template('mysql/my.cnf.erb'),
require => Package['mysql-server'],
notify => Service['mysqld']
notify => Service['mysqld'],
recurse => true,
require => Package[$server_package_name],
}
}

View File

@ -104,8 +104,8 @@ innodb_file_per_table
innodb_log_file_size = 64M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log-error=<%= @log_error %>
pid-file=<%= @pid_file %>
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value