c2b0b4cb2c
The current install pattern used by this module is the following: 1. Install package 2. Install the DB 3. Make the config files In some cases this prevents MySQL to start, because some variables in the config file have an impact on the DB installation. Example with a custom innodb_data_file_path: [ERROR] InnoDB: space header page consists of zero bytes in data file /var/lib/mysql/ibdata This commit changes the order to do: 1. Install package 2. Make the config files 3. Install the DB
83 lines
2.9 KiB
Puppet
83 lines
2.9 KiB
Puppet
# Class: mysql::server: See README.md for documentation.
|
|
class mysql::server (
|
|
$config_file = $mysql::params::config_file,
|
|
$includedir = $mysql::params::includedir,
|
|
$install_options = undef,
|
|
$manage_config_file = $mysql::params::manage_config_file,
|
|
$old_root_password = $mysql::params::old_root_password,
|
|
$override_options = {},
|
|
$package_ensure = $mysql::params::server_package_ensure,
|
|
$package_manage = $mysql::params::server_package_manage,
|
|
$package_name = $mysql::params::server_package_name,
|
|
$purge_conf_dir = $mysql::params::purge_conf_dir,
|
|
$remove_default_accounts = false,
|
|
$restart = $mysql::params::restart,
|
|
$root_group = $mysql::params::root_group,
|
|
$mysql_group = $mysql::params::mysql_group,
|
|
$root_password = $mysql::params::root_password,
|
|
$service_enabled = $mysql::params::server_service_enabled,
|
|
$service_manage = $mysql::params::server_service_manage,
|
|
$service_name = $mysql::params::server_service_name,
|
|
$service_provider = $mysql::params::server_service_provider,
|
|
$create_root_user = $mysql::params::create_root_user,
|
|
$create_root_my_cnf = $mysql::params::create_root_my_cnf,
|
|
$users = {},
|
|
$grants = {},
|
|
$databases = {},
|
|
|
|
# Deprecated parameters
|
|
$enabled = undef,
|
|
$manage_service = undef
|
|
) inherits mysql::params {
|
|
|
|
# Deprecated parameters.
|
|
if $enabled {
|
|
crit('This parameter has been renamed to service_enabled.')
|
|
$real_service_enabled = $enabled
|
|
} else {
|
|
$real_service_enabled = $service_enabled
|
|
}
|
|
if $manage_service {
|
|
crit('This parameter has been renamed to service_manage.')
|
|
$real_service_manage = $manage_service
|
|
} else {
|
|
$real_service_manage = $service_manage
|
|
}
|
|
|
|
# Create a merged together set of options. Rightmost hashes win over left.
|
|
$options = mysql_deepmerge($mysql::params::default_options, $override_options)
|
|
|
|
Class['mysql::server::root_password'] -> Mysql::Db <| |>
|
|
|
|
include '::mysql::server::install'
|
|
include '::mysql::server::config'
|
|
include '::mysql::server::installdb'
|
|
include '::mysql::server::service'
|
|
include '::mysql::server::root_password'
|
|
include '::mysql::server::providers'
|
|
|
|
if $remove_default_accounts {
|
|
class { '::mysql::server::account_security':
|
|
require => Anchor['mysql::server::end'],
|
|
}
|
|
}
|
|
|
|
anchor { 'mysql::server::start': }
|
|
anchor { 'mysql::server::end': }
|
|
|
|
if $restart {
|
|
Class['mysql::server::config'] ~>
|
|
Class['mysql::server::service']
|
|
}
|
|
|
|
Anchor['mysql::server::start'] ->
|
|
Class['mysql::server::install'] ->
|
|
Class['mysql::server::config'] ->
|
|
Class['mysql::server::installdb'] ->
|
|
Class['mysql::server::service'] ->
|
|
Class['mysql::server::root_password'] ->
|
|
Class['mysql::server::providers'] ->
|
|
Anchor['mysql::server::end']
|
|
|
|
|
|
}
|