Explicit "default" or "common" environment?

Hi Chefs,

I’m in the situation where my environment .rb files get larger, but 80% of
the attributes are the same across all files.

This is quite a bit of code duplication, so I was wondering wheter there is
something like an explicit “environments/_default.rb” whose run_list and
attributes would get automatically merged with all other environments?

Is this a bad idea?

Cheers,
Torben

Are the attributes values almost the same across all environments?

If yes - use roles for this. You can define common attributes in a "base" role, and ensure every node has it in run_list. And environments will have only environment-specific attributes.

Also, if your data isn't changed much, you may use data bags.

On Dec 19, 2012, at 10:28 AM, Torben Knerr wrote:

Hi Chefs,

I'm in the situation where my environment .rb files get larger, but 80% of the attributes are the same across all files.

This is quite a bit of code duplication, so I was wondering wheter there is something like an explicit "environments/_default.rb" whose run_list and attributes would get automatically merged with all other environments?

Is this a bad idea?

Cheers,
Torben

--
Vladimir Girnet
Senior Infrastructure Engineer
Tacit Knowledge

Roles would certainly work for this, but I’d love to see the concept for nested environments in the future or at least a super environment concept.

Tim Smith

Operations Engineer, SaaS Operations

From: Vladimir Girnet <vgirnet@tacitknowledge.commailto:vgirnet@tacitknowledge.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Wednesday, December 19, 2012 12:35 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Explicit “default” or “common” environment?

Are the attributes values almost the same across all environments?

If yes - use roles for this. You can define common attributes in a “base” role, and ensure every node has it in run_list. And environments will have only environment-specific attributes.

Also, if your data isn’t changed much, you may use data bags.

On Dec 19, 2012, at 10:28 AM, Torben Knerr wrote:

Hi Chefs,

I’m in the situation where my environment .rb files get larger, but 80% of the attributes are the same across all files.

This is quite a bit of code duplication, so I was wondering wheter there is something like an explicit “environments/_default.rb” whose run_list and attributes would get automatically merged with all other environments?

Is this a bad idea?

Cheers,
Torben


Vladimir Girnet
Senior Infrastructure Engineer
Tacit Knowledge
http://www.tacitknowledge.com