Add a Cookbook to a Node Run List
A 4-step recipe with Chef. We can help you get access.
Recipe · 4 steps
Add a Cookbook to a Node Run List
with Chef
Append a cookbook recipe to a node's run list safely.
- Fetch the cookbook's published versions. A 404 here means the cookbook was never uploaded to this organization and the run list entry would fail at converge time on every node.
- Read the current node object. Infra Server node updates replace the whole document, so the existing attributes must be in hand before writing.
- PUT the node object back with the amended run list, carrying the environment and normal attributes through so nothing is dropped.
- Read the node back and assert the new run list entry is present, proving the change is what the next chef-client run will pick up.
What you'll need to have ready
- cookbookName: The cookbook that must exist before it is added to the run list (e.g. nginx).
- nodeName: The node whose run list is being amended.
- runListEntry: The run list entry to append (e.g. "recipe[nginx::default]").
- runList: The full amended run list to write, including the new entry.
- chefEnvironment: The Chef environment to keep on the node object.
- normalAttributes: The node's normal-precedence attributes, carried through the PUT unchanged.
For your developer
Arazzo workflow chef:update-node-run-list, 4 operations: getCookbook → getNode → updateNode → getNode. Specs on APIs.io.