Define a Role and Assign It to a Node
A 4-step recipe with Chef. We can help you get access.
Recipe · 4 steps
Define a Role and Assign It to a Node
with Chef
Create a Chef role and apply it to a node's run list.
- Create the role with its run list and default attributes. The Infra Server returns 409 if the role name is already taken.
- Read the role back to confirm the server stored the run list before any node is pointed at it.
- Read the target node so its environment and attributes survive the whole-object PUT that follows.
- Write the node back with the role in its run list so the next chef-client run picks up the role's recipes and attributes.
What you'll need to have ready
- roleName: The role name to create (e.g. base).
- roleDescription: A human readable description of what the role does.
- roleRunList: The run list the role expands to (e.g. ["recipe[ntp]", "recipe[users]"]).
- defaultAttributes: Default-precedence attributes carried by the role.
- nodeName: The node that should take on the role.
- nodeRunList: The node's full amended run list, including "role[<roleName>]".
- chefEnvironment: The Chef environment to keep on the node object.
For your developer
Arazzo workflow chef:assign-role-to-node, 4 operations: createRole → getRole → getNode → updateNode. Specs on APIs.io.