diff --git a/manifests/database.pp b/manifests/database.pp index f0a5658..86c9463 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -1,17 +1,17 @@ class kickstack::database inherits kickstack { - case $database { + case $::kickstack::database { 'mysql': { $mysql_service = 'mysql' ensure_resource('class', 'mysql::server', { config_hash => { - 'root_password' => "$mysql_root_password", - 'bind_address' => "0.0.0.0" + 'root_password' => $::kickstack::mysql_root_password, + 'bind_address' => '0.0.0.0' }}) ensure_resource('file', '/etc/mysql/conf.d/skip-name-resolve.cnf', - { source => "puppet:///modules/kickstack/mysql/skip-name-resolve.cnf", + { source => 'puppet:///modules/kickstack/mysql/skip-name-resolve.cnf', }) } 'postgresql': { @@ -19,9 +19,12 @@ class kickstack::database inherits kickstack { 'postgresql::server', { config_hash => { 'ip_mask_deny_postgres_user' => '0.0.0.0/32', - 'ip_mask_allow_all_users' => '0.0.0.0/0', - 'listen_addresses' => '*', - 'postgres_password' => "$postgres_password"}}) + 'ip_mask_allow_all_users' => '0.0.0.0/0', + 'listen_addresses' => '*', + 'postgres_password' => $kickstack::postgres_password }}) + } + default: { + fail("Unsupported value for \$::kickstack::database: ${::kickstack::database}") } } diff --git a/manifests/db.pp b/manifests/db.pp index 152617d..1e0bba5 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -15,9 +15,9 @@ define kickstack::db { $sql_password = $sql_connection ? { undef => pwgen(), default => pick(regsubst(getvar("${fact_prefix}${servicename}_sql_connection"), - ".*://${username}:(.*)@.*/${servicename}", - '\1'), - pwgen()) + ".*://${username}:(.*)@.*/${servicename}", + '\1'), + pwgen()) } # Export facts about the database only after configuring the database @@ -28,18 +28,18 @@ define kickstack::db { # If running on mysql, set the "allowed_hosts" parameter to % so we # can connect to the database from anywhere. case "${database}" { - "mysql": { + 'mysql': { class { "${servicename}::db::mysql": - user => "$username", - password => "$sql_password", - charset => "utf8", - allowed_hosts => '%', - notify => Kickstack::Exportfact::Export["${name}_sql_connection"] + user => $username, + password => $sql_password, + charset => 'utf8', + allowed_hosts => '%', + notify => Kickstack::Exportfact::Export["${name}_sql_connection"] } } default: { class { "${name}::db::${database}": - password => "$sql_password" + password => $sql_password } } }