Skip to content

Instantly share code, notes, and snippets.

@ranjib
Created June 18, 2015 22:13
Show Gist options
  • Save ranjib/2f7e1482a3ac8f6e5bfc to your computer and use it in GitHub Desktop.
Save ranjib/2f7e1482a3ac8f6e5bfc to your computer and use it in GitHub Desktop.
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