cookbook 'attrbagger', '= 0.2.0'
attrbagger (2) Versions 0.2.0 Follow0
Gets attributes from data bags.
cookbook 'attrbagger', '= 0.2.0', :supermarket
knife supermarket install attrbagger
knife supermarket download attrbagger
attrbagger Cookbook
Gets your attributes from your bags.
Somewhat fancy.
Auto-loading
Inclusion of recipe[attrbagger::default] will result in the
keyspec_string => bag_cascade_string_array pairs specified in the
node['attrbagger']['configs'] hash being walked and merged into the
node's attribute precedence level specified via each hash's
precedence_level attribute. An example role using attrbagger to load
application-specific configuration from a base, custom, and dynamic
environment-specific data bag, as well as loading mail service
configuration might look like this:
name 'attrbagger_example' description 'Attrbagger example role' default_attributes( 'deployment_env' => 'demo', 'attrbagger' => { 'configs' => { 'example_app' => { 'precedence_level' => 'override', 'bag_cascade' => [ 'data_bag_item[applications::base::example_app]', 'data_bag_item[applications::example_app]', "data_bag_item[applications::config_<%= node['deployment_env'] %>::example_app]" ] }, 'services::mail' => { 'precedence_level' => 'default', 'bag_cascade' => [ 'data_bag_item[services::mail]' ] } } }, 'example_app' => { 'awesome' => true }, 'mail' => { 'host' => 'localhost', 'port' => 25 } ) run_list( 'recipe[attrbagger]', # ... other stuff )
This would result in the following actions:
- Load
data_bag_item('applications', 'base')and merge itsexample_apphash withnode.default['example_app'], then assign the result tonode.override['example_app'] - Load
data_bag_item('applications', 'example_app')and merge the entire data bag contents (except for builtin attributes likeidandchef_type) withnode.default['example_app'], then assign the result tonode.override['example_app']. - Load
data_bag_item('applications', 'config_demo')and merge itsexample_apphash withnode.default['example_app'], then assign the result tonode.override['example_app'] - Load
data_bag_item('services', 'mail')and merge the entire data bag contents (except for builtin attributes likeidandchef_type) withnode.default['services']['mail'], then assign the result tonode.default['services']['mail'].
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.