I am trying to generate separate jndi.xml files for a mule_config module I'm building. Current setup:
Filesystem setup: /opt/mule-instance-a/conf/jndi.xml /opt/mule-instance-b/conf/jndi.xml etc, etc Currently I have created a defined type named mule_config to create the /opt/mule-instance-a directory structure and configuration. # Create the mule instance config files and create directories define mule::mule_config( #param list ){ ##Shortened to just this stanza file { "/opt/${instance}/conf/jndi.xml": ensure => file, owner => 'tomcat', group => 'tomcat', mode => '0660', content => template("pg/${jndi_env}${instance}-jndi.xml.erb") } } My profile::mule looks like this: class profile::mule { $mule_instances = hiera('mule_instances', []) create_resources( 'pg::mule_config', $mule_instances ) } Here's my sanitized hiera: mule_instances: mule-instance-a: instance: "mule-instance-a" mule-instance-b: instance: "mule-instance-b" What I would like to do is create the jndi.xml dynamically instead of using a separate template file for each instance. The jndi.xml file has repeatable elements (queues, jdbc connections, property map keys) that I would like to use the concat module and other create_resources defined types to build and use as the input to the /opt/${instance}/conf/jndi.xml file. I have created a mule_jndi class that does this but I'm not sure how to pass some parameters to it from the create_resources('pg::mule_config) defined type that it needs and use it as input to the file resource in the calling defined type. Basically I'm trying to use create_resources to create a jndi.xml file that becomes the input to the file resource in the mule_config defined resource. Here's my mule_jndi class that concats a jndi.xml file to /tmp/jndi # Generates mule instance jndi.xml file class mule::mule_jndi (){ $jndi = 'jndi.xml' concat { $jndi: path => "/tmp/${jndi}", mode => '0660' } concat::fragment{ 'jndi_header': target => $jndi, content => template('mule/header.erb'), order => '01' } define mule::queue($id, $queuetype, $value) { concat::fragment{ "queue${id}": target => 'jndi.xml', content => template('mule/queue.erb'), order => '03' } } $queues = hiera('mule_queues', []) create_resources( 'mule::queue', $queues ) define mule::dbconn( $db_connstr, $db, $db_hostname = hiera('pg::db_hostname'), $db_port = hiera('pg::db_port'), $db_user, $db_pass, $db_maxactive ) { concat::fragment{ "dbconns${id}": target => 'jndi.xml', content => template('mule/dbconn.erb'), order => '02' } } $db_conns = hiera('dbconns', []) create_resources( 'mule::dbconn', $db_conns ) concat::fragment{ 'propertymap_header': target => $jndi, content => template('mule/propertymap.erb'), order => '04' } define mule::db_propertymap( $db_connstr, ) { concat::fragment{ "dbmaps${id}": target => 'jndi.xml', content => template('mule/db_propertymap.erb'), order => '05' } } $db_props = hiera('dbprops', []) create_resources( 'mule::db_propertymap', $db_props ) define mule::queue_propertymap( $id, $value ) { concat::fragment{ "queues${id}": target => 'jndi.xml', content => template('mule/queue_propertymap.erb'), order => '06' } } $queue_props = hiera('queueprops', []) create_resources( 'mule::queue_propertymap', $queue_props ) concat::fragment{ 'propertymap_footer': target => $jndi, content => template('mule/propertymap_footer.erb'), order => '07' } notice ('/tmp/jndi.xml has been created.') } Any help, hints, what the hell are you doing is welcome. Thank you for your time. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/598861a4-b6a5-4bd7-a37c-032dd09ec6db%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.