class wsp::mysql { $line = 'intra3' $wsps = hiera('wsps') create_resources("wsp::mysql::app", $wsps) } define wsp::mysql::app ($tcname=$tcname) { $db_cons = hiera('db_cons', {}) # this will hit duplicate resources when two apps talk to the same db create_resources("wsp::mysql::createdb", $db_cons) } define wsp::mysql::createdb ($type, $dbserver, $dbport, $jdbc, $user, $password, $max_active=50, $max_idle=6, $init_size=5) { if $dbserver == $hostname { notify { "Create DB: $name": } database { "${name}": charset => 'latin1', } # Collect any grants from the Apps Database_user <<| tag = "wsp::database::${name}" |>> Database_grant <<| tag = "wsp::database::${name}" |>> } } define wsp::mysql::grantuser () { }