[chef] Re: Where do YOU put your environment and role files?


Chronological Thread 
  • From: Xabier de Zuazo < >
  • To:
  • Subject: [chef] Re: Where do YOU put your environment and role files?
  • Date: Mon, 9 Mar 2015 20:18:08 +0100

On 2015-03-09 14:21, Fabien Delpierre wrote:
> [...]
> I could just gut the old Chef repo, removing all the cookbooks and leaving
> only the environments, roles and data bags, then point my Vagrantfiles to
> the same paths for those types of resources every time, but most of the
> time, the environments or roles make no sense except when considered in the
> context of a given cookbook.
> 
> It would make sense (to me at least) to keep them with the cookbook they're
> meant to be used with, and to put them in the same git repo as the
> cookbook, but then when I use Berkshelf to create a cookbook, it creates
> the standard directory structure and it feels weird to me to add a
> ./environments and a ./roles under my cookbook's directory structure,
> alongside the ./attributes, ./recipes and so forth.
> 
> So does it make more sense to keep the environments and roles in the same
> git repo as a cookbook, or continue to keep all environments and roles in a
> central repo, like so:
> 
> chef-repo
>  |_ cookbooks
>      |_ cookbook1
>          |_ individual git repo
>          |_ Vagrantfile pointed at ../../ for environments and roles
>      |_ cookbook2
>          |_ individual git repo
>          |_ Vagrantfile pointed at ../../ for environments and roles
>      |_ etc.
>  |_ environments
>      |_ all environments ever written
>  |_ roles
>      |_ all roles ever written
>  |_ .gitignore to ignore contents of ./cookbooks
> 
> What about data bags? Keep them directly under the repo, or with individual
> cookbooks? Or both, depending on what makes the most sense?

In our case, we are using a provisioning cookbook that uses the
chef-provisioning gem and we put the environments and the data bags inside 
this
cookbook recipes. Something like this:

myapp_provisioning::environments
myapp_provisioning::data_bags
myapp_provisioning::roles
...

You could put them in the same cookbook, in a recipe called something like
`myapp::provisioning`. But that could be confusing, because those recipes are
used differently.

The downside is you can not include them with vagrant so easily :-(

https://docs.chef.io/provisioning.html#chef-environment

-- 
Xabier de Zuazo

Attachment: signature.asc
Description: Digital signature




Archive powered by MHonArc 2.6.16.

§