I would like to do something like this:
attributes/default.rb
if node[:chef_environment] == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
But it appears that 'node' is equal the name of the current node.
Try node.chef_environment
? It's a function which returns the value rather than an attribute.
Inside an attribute file, I think you want to use just chef_environment
, according to this post in the Chef Mailing List, and independently confirmed by me.
Your attribute file should then look like this:
if chef_environment == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
node.chef_environment
will work in recipes.
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