module-puppetlabs-mysql/manifests/server/root_password.pp
Franz Schwartau 02564bfe08 Add new parameters create_root_user and create_root_my_cnf.
This allows the galera module and others to write ${::root_home}/.my.cnf
independently from create the mysql user. This is useful for cluster
setups where you want to create ${::root_home}/.my.cnf on every node
but create the user only once.
2014-10-06 10:53:30 +02:00

23 lines
651 B
Puppet

#
class mysql::server::root_password {
$options = $mysql::server::options
# manage root password if it is set
if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' {
mysql_user { 'root@localhost':
ensure => present,
password_hash => mysql_password($mysql::server::root_password),
}
}
if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' {
file { "${::root_home}/.my.cnf":
content => template('mysql/my.cnf.pass.erb'),
owner => 'root',
mode => '0600',
require => Mysql_user['root@localhost'],
}
}
}