Amazon Web Services Opsworks platform provides a convenient way to deploy custom servers and applications via Chef recipes. Oddly thought, custom JSON (which is passed along to chef-solo) is only able to be configured at the stack level (which encompasses entire environments) rather than the layer level (which encompasses similar groups of servers within an environment, such as database or application servers.)
This cookbook solves this problem by allowing you to define per-layer custom JSON within the stack's custom JSON. All you need to do is define the JSON you expect a layer to receive underneath within the stack's custom JSON as follows:
{
"opsworks-layer-json-attributes": {
"my-layer-short-name": {
"my-custom-attribute": "my-custom-value",
},
},
}
and include "opsworks-layer-json-attributes::default"
as the first element in each of the custom recipe lists in your layer (setup, deploy, etc.)
All platforms. Intended for use on Amazon Web Services Opsworks.
Key | Type | Description |
---|---|---|
['opsworks-layer-json-attributes'][Your layer's short name] | Hash | set of attributes to be mixed in to the node's attributes |
Include opsworks-layer-json-attributes
in your node's run_list
:
{
"run_list": [
"recipe[opsworks-layer-json-attributes::default]"
]
}
- Fork the repository on Github
- Create a named feature branch (i.e.
add-new-recipe
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request
Author: James ([email protected])
Licensed under the MIT license:
Copyright (c) 2014 James Coleman
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.