Add mysql_host param to refstack class
This will allow the mysql host to be passed in, and allow for a non-localhost mysql server to be used. If mysql_host is passed in and not 'localhost', then we assume that the mysql_database has already been created with mysql_user already granted access. Change-Id: I161d8dd2e605425f8dc9e3e42adf3734cb43e627
This commit is contained in:
parent
4f06b81398
commit
70b1bfc9b5
|
@ -18,6 +18,7 @@
|
|||
# directly from its git repositories.
|
||||
#
|
||||
class refstack (
|
||||
$mysql_host = 'localhost',
|
||||
$mysql_database = 'refstack',
|
||||
$mysql_user = 'refstack',
|
||||
$mysql_user_password,
|
||||
|
@ -35,6 +36,7 @@ class refstack (
|
|||
# Configure the entire refstack instance. This does not install anything,
|
||||
# but ensures that variables are consistent across all modules.
|
||||
class { '::refstack::params':
|
||||
mysql_host => $mysql_host,
|
||||
mysql_database => $mysql_database,
|
||||
mysql_user => $mysql_user,
|
||||
mysql_user_password => $mysql_user_password,
|
||||
|
|
|
@ -15,25 +15,28 @@
|
|||
# == Class: refstack::mysql
|
||||
#
|
||||
# The RefStack MySQL manifest will install a standalone, localhost instance
|
||||
# of mysql for refstack to connect to.
|
||||
# of mysql if mysql_host is set to 'localhost'.
|
||||
#
|
||||
class refstack::mysql () {
|
||||
|
||||
require ::refstack::params
|
||||
|
||||
# Import parameters.
|
||||
$mysql_host = $refstack::params::mysql_host
|
||||
$mysql_database = $refstack::params::mysql_database
|
||||
$mysql_user = $refstack::params::mysql_user
|
||||
$mysql_user_password = $refstack::params::mysql_user_password
|
||||
|
||||
# Install MySQL
|
||||
include ::mysql::server
|
||||
if $mysql_host == 'localhost' {
|
||||
include ::mysql::server
|
||||
|
||||
# Add the refstack database.
|
||||
mysql::db { $mysql_database:
|
||||
user => $mysql_user,
|
||||
password => $mysql_user_password,
|
||||
host => 'localhost',
|
||||
grant => ['all'],
|
||||
# Add the refstack database.
|
||||
mysql::db { $mysql_database:
|
||||
user => $mysql_user,
|
||||
password => $mysql_user_password,
|
||||
host => $mysql_host,
|
||||
grant => ['all'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue