Skip to content

Instantly share code, notes, and snippets.

@sneal
Last active May 13, 2023 15:06
Show Gist options
  • Save sneal/8347772 to your computer and use it in GitHub Desktop.
Save sneal/8347772 to your computer and use it in GitHub Desktop.
In addition to role cookbooks... a single environment cookbook with a recipe per environment. Allows locking of roles and environments to specific versions and keeps most of the configuration logically together without any secret sauce.
# turn off dev_mode for the entire production environment
node.override['daptiv_site']['dev_mode'] = false
# base application recipe
include_recipe 'daptiv_site::sso'
# set some versioned role attributes (i.e. same value across all environments)
node.override['daptiv_site']['sso']['doc_root'] = 'd:/daptiv/sso'
# set some versioned environment specific attributes
include_recipe "daptiv_environments::#{node.chef_environment}"
name "sso"
description "Daptiv SSO login server role"
run_list(
"recipe[daptiv_sso_role::default]"
)
@sneal
Copy link
Author

sneal commented Jan 14, 2014

Assumptions:

  • We have a daptiv_environments cookbook which has a recipe for each and every environment. Each recipe contains all the environment specific attributes.
  • We use roles 1:1 with a role cookbook and the role just includes the role cookbook in its runlist (and nothing else).
  • Application cookbooks use regular attributes. Role cookbooks can set these attributes from data bags if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment