Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Consuming common datra across environments using Chef's ruby environment DSL
# located at chef_repo/environments/org1-prod.rb
require 'deep_merge'
name 'org1-prod'
description 'Production environment for org1'
org1_yml_path = File.expand_path('../common/org1.yml', __FILE__)
common = YAML.load_file(org1_yml_path)
default_attributes(
common['default'].deep_merge!(
# declare all you org1-prod specific things here.
'x' => 1,
'y' => 2
)
)
# located at chef_repo/emvironments/common/org1.yml
--
default:
org1:
bar: baz
strange: [1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment