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


Chronological Thread 
  • From: Tensibai Zhaoying < >
  • To:
  • Subject: [chef] Re: Defining dynamic global custom variables once for all recipes during chef run
  • Date: Tue, 28 Apr 2015 23:21:22 +0200

I don't know if it's the best way but we so this with an Env cookbook with many attributes files, one common for all invariable values and one file per Env starting With 'return unless node.chef_environment == "target_env"'

Le 28 avr. 2015 19:28, Mathew Crane < > a écrit :
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.

§