| popularity | question | answers | views | user | |
|---|---|---|---|---|---|
| 2 |
Overriding attributes referenced by other attributes
I am having trouble understanding the proper way to define my recipe’s attributes and allow for certain ones to be overridden in roles. The classic example is where you have one attribute for the version of an external library and then another attribute that constructs a URL which references the first version attribute. Then, if the version number is overridden, the URL gets updated as well. Example: attributes/default.rb
recipes/default.rb
roles/noodle.rb
chef-client run output
Using ‘override_attributes’ instead of ‘default_attributes’ doesn’t make a difference:
chef-client run output
I have discovered that if I literally set one of those attributes on the node, it gets picked up. Set node attribute with ‘knife node edit NODE’:
Then a chef-client run shows:
Isn’t this what roles are for? I need to be able to manage attributes like this en masse and in source control (role files). There are several official cookbooks that are designed the same way such as java, couchdb, and munin so it seems like it should be supported somehow. |
1 | 1.3k |
