[chef] Defining dynamic global custom variables once for all recipes during chef run


Chronological Thread 
  • From: Mathew Crane < >
  • To: chef < >
  • Subject: [chef] Defining dynamic global custom variables once for all recipes during chef run
  • Date: Tue, 28 Apr 2015 13:28:51 -0400

Scenario:
- Two custom variables are dynamically assigned based on node.chef_environment via a targeted search and subsequent for-loop against a max of 10 top-level data bag items.
- Both variables are a DataBagItem.
- They are defined within any recipe that needs these values. 
- Setting this in every recipe doesn't scale.

Is there a way to define these variables once in a separate, single-purpose cookbook recipe, and have them reliably made available to all recipes within the chef run?

What is the best direction for this? Setting attributes via attributes/default.rb or creating a custom library with a ruby block?

Thanks!
-Mat


 




Archive powered by MHonArc 2.6.16.

§