AleZucchelli
AleZucchelli

Reputation: 55

How to override variable in chef recipe?

I need your help.

I have a series of chef cookbooks. I have a java cookbooks, and in the java attributes default, I set this variable:

default['java']['windows']['url'] = "path download jdk 7"

I create other varible contain the link for download other java version.

Now, i want to install Modelio using chef. Modelio needs jdk 8. Can I into modelio recipe override this variable default['java']['windows']['url']?

Thanks to all

Upvotes: 0

Views: 1093

Answers (1)

Ken Brittain
Ken Brittain

Reputation: 2265

Your cookbook can set the attribute to the desired value according to the chart presented here. Just remember that cookbook are synced and the compiled.

Once the attributes are resolved, according to the rules stated previously in the docs, then the resource are executed. So, overriding an attribute from another cookbook is possible and used often.

Upvotes: 1

Related Questions