diff --git a/manifests/init.pp b/manifests/init.pp index 06fa6c0..2af686b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, diff --git a/manifests/mysql.pp b/manifests/mysql.pp index a86bd15..8c5156a 100644 --- a/manifests/mysql.pp +++ b/manifests/mysql.pp @@ -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'], + } } }