Nested create_resources and nested hashes inside hiera

asked 2015-07-15 08:26:08 -0600

simh gravatar image

updated 2015-07-15 08:42:11 -0600

Hi again!

I have another question, related to multiinstances of tomcat servers. This is somewhat connected to my question: http://ask.puppetlabs.com/question/18...

Right now I have multiple instances of tomcat, created using createresources and I just came to the point that I need to provide multiple http connectors and muliple datasources. I was thinking about using createresources again... but I cannot find a proper way to put the information into hiera.

What I was thinking about was to he it like that:

tomcat:instances:
 i01:
  catalina_base: "path"
  params: "values"
  tomcat_http_connectors:
   "i01-http":
     ensure: "present"
     protocol: "HTTP protocol"
 i02:
  catalina_base: "path"
  params: "values"
  tomcat_http_connectors:
   "i02-http":
     ensure: "present"
     protocol: "HTTP protocol"

and I would use:

$instances = hiera_hash('tomcat:instances')
create_resource(tomcat,$instances )

and inside my tomcat class I would have

$http_connector = hiera_hash('tomcat_http_connectors')
create_resource(tomcat::connector,$http_connector)

Sadly, that does not work. I am not scared about refacotring this if there is a better way, but what I need to keep in mind that I need multiple instances of tomcat and multiple instances of datasources (can sometimes be different for each instance).

Ideas? :)

EDIT: For me this is very similar to have one apache, with multiple vhosts, with multiple <directory> statements in each.

edit retag flag offensive close merge delete