Added support for using MySQL with root password.
This commit is contained in:
parent
9ce131a5d2
commit
ac5d6987d3
1 changed files with 25 additions and 6 deletions
|
@ -17,6 +17,9 @@ class mysql::client {
|
|||
# $mysql_datadir:
|
||||
# Directory where MySQL databases are stored.
|
||||
#
|
||||
# $mysql_root_password:
|
||||
# Password for MySQL server root user.
|
||||
#
|
||||
class mysql::server {
|
||||
|
||||
package { "mysql-server":
|
||||
|
@ -94,6 +97,8 @@ class mysql::server {
|
|||
require => Package["mysql-server"],
|
||||
}
|
||||
|
||||
case $mysql_root_password {
|
||||
"": {
|
||||
file { "/var/lib/mysql":
|
||||
ensure => directory,
|
||||
mode => "0700",
|
||||
|
@ -101,6 +106,20 @@ class mysql::server {
|
|||
group => "mysql",
|
||||
require => Package["mysql-server"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
file { "/root/.my.cnf":
|
||||
ensure => present,
|
||||
content => "[client]\nuser='root'\npassword='${mysql_root_password}'\n",
|
||||
mode => "0600",
|
||||
owner => "root",
|
||||
group => $operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue