Add Nodes for the Chef Server to Manage
agent runs Chef recipes on physical or virtual computers, called
nodes, that are associated with the server. You can connect
on-premises computers or instances to the Chef server to manage, provided the nodes are
running supported operating systems. Registering nodes with the Chef server installs the
chef-client agent software on those nodes.
This walkthrough demonstrates how to run a
knife command that adds, or
bootstraps, an EC2 instance so that the Chef server can manage it.
For more information about how to add nodes automatically by using a script to perform
unattended association of nodes with the Chef server, see Adding Nodes Automatically in AWS OpsWorks for Chef Automate.
Supported Operating Systems
For the current list of supported operating systems for nodes, see the Chef website.
Add Nodes with Knife
plug-in is included with the Chef DK. If you are more familiar with
knife-ec2, you can use it instead of
knife bootstrap to
provision and bootstrap new EC2instances. Otherwise, launch a new EC2 instance, and then
follow the steps in this section.
To add nodes to manage
Run the following
knife bootstrapcommand. This command bootstraps an EC2 instance to the nodes that your Chef server will manage. Note that you are instructing the Chef server to run recipes from the
apache2cookbook that you installed in Use Berkshelf to Get Cookbooks from a Remote Source. For more information about adding nodes by running the
knife bootstrapcommand, see Bootstrap a Node in the Chef documentation.
The following table shows valid user names for node operating systems in the
knifecommand in this step. If neither
ec2-userworks, check with your AMI provider. For more information about connecting to Linux-based instances, see Connecting to Your Linux Instance Using SSH in the AWS documentation.
Valid values for user names in node operating systems
Operating System Valid User Names Amazon Linux
Red Hat Enterprise Linux 5
USER_NAME--sudo --run-list "recipe[apache2]"
Verify that the new node was added by running the following commands, replacing
INSTANCE_NAMEwith the name of the instance that you just added.
knife client show
INSTANCE_NAMEknife node show
Visit the Learn Chef tutorial site to learn more about using AWS OpsWorks for Chef Automate servers and Chef Automate premium features.