|
OverviewChef does deep merging of mutilevel hashes and arrays for role and environment attributes. These can assist in code reuse by allowing you to layer your configuration among many roles, while still making use of default attributes set at the cookbook level.See Attributes for more background information.ExamplesSimple mergeFirst our lowest level server role roles/baseline.rb next our more customized web server role which uses the baseline role roles/web.rb then using a recipe like cookbooks/baseline/recipes/default.rb and a run_list set to run_list/web.json produces which mixes the default attributes from cookbooks/apache2/attributes/default.rb, the overrides from baseline.rb and the final overrides from web.rb quite nicely, setting startservers to 30. With this in mind the examples below will use short hand. SubstitutionHash - Substitute an existing string Hash - Substitute an existing boolean
Array - Substitute an existing string Substitute an Array with a Hash when items can't be merged the original data is overwritten AdditionHash - Add a string Array - Add a string Hash - Multilevel Add Array - Multilevel Add Subtraction
Hash - Remove a string Array - Remove a string
Array - Remove all values Array - Remove an integer You can't use !merge:<value> with integers, to get rid of 4 you'll have to dump them all.
|
|
|
Labels:
None


