Using AWS OpsWorks , how would you set up an environment (production, production, etc.) that will be applied to an attribute , and then cookbooks can read this attribute? (I think this can be done using custom JSON, right?) node.chef_environment
I came across this link , but still don't know how to do it.
With Vagrant, I can install it in a Vagrantfile as follows:
config.vm.provision :chef_solo do |chef|
...
chef.environment = "local"
...
end
Thanks.
UPDATE:
I decided to solve the problem by writing my_environment_cookbookthat only has this code in my default recipe:
if node[:chef_environment] != nil
node.chef_environment = node[:chef_environment]
end
And in the custom JSON of the OpsWorks stack, I had something like this:
{
"chef_environment": "staging"
}
my_environment_cookbook , , node.chef_environment.