module-puppetlabs-mysql/manifests/server/install.pp

37 lines
1.1 KiB
ObjectPascal
Raw Normal View History

#
class mysql::server::install {
package { 'mysql-server':
ensure => $mysql::server::package_ensure,
install_options => $mysql::server::install_options,
name => $mysql::server::package_name,
}
# Build the initial databases.
2014-12-05 10:45:38 +01:00
$mysqluser = $mysql::server::options['mysqld']['user']
$datadir = $mysql::server::options['mysqld']['datadir']
$basedir = $mysql::server::options['mysqld']['basedir']
$config_file = $mysql::server::config_file
2014-12-05 10:45:38 +01:00
if $mysql::server::manage_config_file {
$install_db_args = "--basedir=${basedir} --defaults-extra-file=${config_file} --datadir=${datadir} --user=${mysqluser}"
} else {
$install_db_args = "--basedir=${basedir} --datadir=${datadir} --user=${mysqluser}"
}
exec { 'mysql_install_db':
command => "mysql_install_db ${install_db_args}",
creates => "${datadir}/mysql",
logoutput => on_failure,
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
require => Package['mysql-server'],
}
2014-07-08 19:24:23 +02:00
2014-12-05 10:45:38 +01:00
if $mysql::server::restart {
Exec['mysql_install_db'] {
notify => Class['mysql::server::service'],
2014-07-08 19:24:23 +02:00
}
}
}