Set chef environment at initialization of node


#1

Hi all,

This has probably been addressed already, but I can’t find it in the archive
(since the word “environment” means so many different things). I want to set my
chef environment at node instantiation. I currently use “knife ec2 server
create …” to bootstrap the ec2 instance with centos6-gems.

I have two different environments, “staging” and “production”, and I want to
make sure that production doesn’t get newer versions of the cookbooks until
they’ve been qualified in staging. Is there a straightforward way of
accomplishing this?

I have tried setting knife.rb
knife[:environment] = “production”

and I even tried adding to client.rb in the bootstrap:
environment “production”

But neither of these worked. Any thoughts?

Thank you!
Vincent


#2

On Fri, Nov 11, 2011 at 2:02 PM,
vincent.jorgensen@incentivenetworks.com wrote:

Hi all,

Thank you!
Vincent

knife bootstrap and knife ec2 take a “-E” parameter that sets the
environment for you.

I know it was broken in the past but it should be working now.