When you include a recipe in another recipe how to do you override the attributes.
It looks the include recipe used the default attributes not the attributes of the recipe when it was run previously in the run_list.
You can not override a attribute, only hide it. This is literally called hiding fields in the tutorial. More details on this blog.
Cookbooks serve as the fundamental unit of configuration and policy details that Chef uses to bring a node into a specific state. This just means that Chef uses cookbooks to perform work and make sure things are as they should be on the node.
When you are creating a wrapper cookbook, it is common to override attributes.
Suppose, you have my_web_server cookbook with my_web_server/recipes/default.rb
like this:
include_recipe "apache2"
And you would like to override attribute default_site_enabled from apache2 cookbook.
Then your file my_web_server/attributes/default.rb
should look like:
override['apache']['default_site_enabled'] = true
And don't forget to specify dependencies in my_web_server/metadata.rb
like:
depends "apache2"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With