[chef] Re: Re: Re: Moving role attributes into cookbooks


Chronological Thread 
  • From: Daniel Condomitti < >
  • To:
  • Subject: [chef] Re: Re: Re: Moving role attributes into cookbooks
  • Date: Mon, 17 Mar 2014 12:59:48 -0700

You don’t need to use knife-ec2 to get those attributes. Create /etc/chef/hints/ec2.json (empty file is fine) and ohai will automatically set a LOT of instance metadata attributes including ec2.placement_availability_zone.

On Monday, March 17, 2014 at 12:51 PM, Douglas Garstang wrote:

Jeff,

We are using EC2 (and GCE). However, we aren't using knife to provision systems. We weren't able to get the knife ec2 plugin to work with an ssh proxy and gave up in the end.

I just tried a different approach, where I have one cookbook, with one recipe per location. This gets around the issue of having to depend on an arbitrary list of location cookbooks in the metadata.rb of every cookbook we write. However, the trade-off is that I have to do this:

include_recipe "bc-location::#{some-special-key-to-determine-location}"

every single time I need to access location data. This is horrid. I simply can't understand why people keep saying not to use roles. Roles are just so much more convenient. All the include magic is done automatically for you.

Douglas.


On Mon, Mar 17, 2014 at 11:23 AM, Jeff Byrnes < " target="_blank"> > wrote:
Doug:

I’m not sure if you’re using EC2, but if so, and you’re launching instances using knife-ec2, you should have node['ec2']['placement_availability_zone'] available. You could build a single wrapper cookbook, that depends on that attribute’s value, and determines the requisite data center-specific attributes.

-- 
Jeff Byrnes
@berkleebassist
Operations Engineer

On March 17, 2014 at 1:54:21 PM, Douglas Garstang ( " target="_blank"> ) wrote:

Doing what I read to be a best practice, I just took a bunch of roles that defined set attributes for specific data centers, and moved them into cookbooks, one per location, ie:

bc-location-u1
bc-location.eu1

and so on. I just occurred to me that if I do this, then all cookbooks will need to depend (in the metadata.rb) file on ALL of these location based cookbooks.

is this correct? What am I missing?

Doug





--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: ">
Cell: +1-805-340-5627




Archive powered by MHonArc 2.6.16.

§