2011-06-01 05:47:19 +02:00
|
|
|
# Class: mysql::server
|
|
|
|
#
|
2012-02-09 20:26:00 +01:00
|
|
|
# manages the installation of the mysql server. manages the package, service,
|
|
|
|
# my.cnf
|
2011-06-01 05:47:19 +02:00
|
|
|
#
|
|
|
|
# Parameters:
|
2012-02-09 20:26:00 +01:00
|
|
|
# [*package_name*] - name of package
|
|
|
|
# [*service_name*] - name of service
|
|
|
|
# [*config_hash*] - hash of config parameters that need to be set.
|
2011-06-01 05:47:19 +02:00
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
#
|
2012-02-09 20:26:00 +01:00
|
|
|
class mysql::server (
|
2012-03-16 23:56:04 +01:00
|
|
|
$package_name = $mysql::params::server_package_name,
|
|
|
|
$package_ensure = 'present',
|
|
|
|
$service_name = $mysql::params::service_name,
|
|
|
|
$service_provider = $mysql::params::service_provider,
|
2012-06-18 23:01:38 +02:00
|
|
|
$config_hash = {},
|
|
|
|
$enabled = true
|
2011-05-27 03:11:24 +02:00
|
|
|
) inherits mysql::params {
|
2011-06-16 19:49:15 +02:00
|
|
|
|
2012-03-15 08:51:35 +01:00
|
|
|
Class['mysql::server'] -> Class['mysql::config']
|
|
|
|
|
2012-03-18 07:56:13 +01:00
|
|
|
$config_class = {}
|
|
|
|
$config_class['mysql::config'] = $config_hash
|
|
|
|
|
|
|
|
create_resources( 'class', $config_class )
|
2011-06-16 19:49:15 +02:00
|
|
|
|
2012-02-09 20:26:00 +01:00
|
|
|
package { 'mysql-server':
|
2011-05-27 03:11:24 +02:00
|
|
|
name => $package_name,
|
2012-02-09 20:26:00 +01:00
|
|
|
ensure => $package_ensure,
|
2011-05-25 08:22:43 +02:00
|
|
|
}
|
2012-02-09 20:26:00 +01:00
|
|
|
|
2012-06-18 23:01:38 +02:00
|
|
|
if $enabled {
|
|
|
|
$service_ensure = 'running'
|
|
|
|
} else {
|
|
|
|
$service_ensure = 'stopped'
|
|
|
|
}
|
|
|
|
|
2011-05-25 08:22:43 +02:00
|
|
|
service { 'mysqld':
|
2012-03-16 23:56:04 +01:00
|
|
|
name => $service_name,
|
2012-06-18 23:01:38 +02:00
|
|
|
ensure => $service_ensure,
|
|
|
|
enable => $enabled,
|
2012-03-16 23:56:04 +01:00
|
|
|
require => Package['mysql-server'],
|
|
|
|
provider => $service_provider,
|
2011-05-25 08:22:43 +02:00
|
|
|
}
|
2012-02-09 20:26:00 +01:00
|
|
|
|
2011-06-22 20:38:11 +02:00
|
|
|
}
|