c4e0e64782
When using failover options such as Corosync, it's preferable to allow the failover software to manage the starting and stopping of the service. This parameter allows that to happen.
53 lines
1.2 KiB
Puppet
53 lines
1.2 KiB
Puppet
# Class: mysql::server
|
|
#
|
|
# manages the installation of the mysql server. manages the package, service,
|
|
# my.cnf
|
|
#
|
|
# Parameters:
|
|
# [*package_name*] - name of package
|
|
# [*service_name*] - name of service
|
|
# [*config_hash*] - hash of config parameters that need to be set.
|
|
#
|
|
# Actions:
|
|
#
|
|
# Requires:
|
|
#
|
|
# Sample Usage:
|
|
#
|
|
class mysql::server (
|
|
$package_name = $mysql::params::server_package_name,
|
|
$package_ensure = 'present',
|
|
$service_name = $mysql::params::service_name,
|
|
$service_provider = $mysql::params::service_provider,
|
|
$config_hash = {},
|
|
$enabled = true,
|
|
$manage_service = true
|
|
) inherits mysql::params {
|
|
|
|
Class['mysql::server'] -> Class['mysql::config']
|
|
|
|
$config_class = { 'mysql::config' => $config_hash }
|
|
|
|
create_resources( 'class', $config_class )
|
|
|
|
package { 'mysql-server':
|
|
ensure => $package_ensure,
|
|
name => $package_name,
|
|
}
|
|
|
|
if $enabled {
|
|
$service_ensure = 'running'
|
|
} else {
|
|
$service_ensure = 'stopped'
|
|
}
|
|
|
|
if $manage_service {
|
|
service { 'mysqld':
|
|
ensure => $service_ensure,
|
|
name => $service_name,
|
|
enable => $enabled,
|
|
require => Package['mysql-server'],
|
|
provider => $service_provider,
|
|
}
|
|
}
|
|
}
|