Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 257

iterate through consul items in hiera

$
0
0
I have the consul backend as follows: application/ESC/DeploymentDemo/ESC-DeploymentDemo-trunk/web/database_model The hierarchy in the database_model should be something as follows: application/ESC/DeploymentDemo/ESC-DeploymentDemo-trunk/web/database_model/Oracle/resource_name etc., Say for DB2, it is as follows: application/ESC/DeploymentDemo/ESC-DeploymentDemo-trunk/web/database_model/DB2/resource_name etc., Question: I need to create a ***tomcat::config::context::resource*** with each of the datasources. How do i iterate through the hiera elements and create a Resource tag for each datasource? I tried something like this and it didn't even get called: Not sure what the problem is: I am using ***puppet 4.5.2***, Any help is much appreciated. $consul_db_model = hiera('database_model',[]) $consul_db_model.each |String $item| { tomcat::config::context::resource { 'jdbc' : resource_name => $item.resource_name, resource_type => $item.resource_type, additional_attributes => { auth => $item.auth, maxActive => $item.maxActive, maxIdle => $item.maxIdle, minIdle => $item.minIdle, maxWait => $item.maxWait, username => $item.username, password => $item.password, driverClassName => $item.driverClassName, url => $item.url, }, } } database_model datasource_name1 resource_name resource_type auth maxActive maxIdle minIdle maxWait username password driverClassName url urls_database_driver_jars datasource_name2 resource_name resource_type auth maxActive maxIdle minIdle maxWait username password driverClassName url urls_database_driver_jars

Viewing all articles
Browse latest Browse all 257

Trending Articles