[chef] Dynamic resource naming in recipe


Chronological Thread 
  • From: Tensibai < >
  • To:
  • Subject: [chef] Dynamic resource naming in recipe
  • Date: Thu, 04 Sep 2014 17:59:32 +0200

Hello alls,

I'm wondering if a resource could be made up with variables.

I've specific LWRPs called:

 

deploy_tomcat_swing

deploy_tomcat_war

deploy_jboss_swing

 

My 'applications' cookbooks define the app type (swing or war, along other types (6 at all)) and my server cookbook define the server type and the apps on this instance.

A node could have many instances too.

One requirement is to deploy on each instance the apps needed in one pass (we don't want 8 client.rb on a node, one for its system and 7 for its instances).

Actually I've a loop over the instances and a nested loop dor the app.

 

Now that I'm inside this dual loop, I know the instance type and the application type and I've something like:

 

if instance_type='tomcat' then

 case application_type

 when 'swing'

      deploy_tomcat_swing

 when [....]

end

if [...] then

 same loop as above

end

 

I think you got the idea of how hard it is to add a new packaging type for applications...

 

Now I gave the context is this something handlable to define the ressource dynamically with something like

deploy_#{instance_type}_#{application_type}

 

I did some test with send but its far from working...

If its absolutely stupid, tell me ;)

Thanks for reading till here

 

Tensibai

 

 

 



Archive powered by MHonArc 2.6.16.

§