A Chef node is a physical or virtual machine with an operating system that is connected to the Chef server. Once the node has made the connection to the Chef server, the installed Chef Client can execute Chef cookbooks to configure the machine.
Bootstrapping is the process to connect the node the first time to the Chef server, or to attach it again if the node lost the connectivity to the Chef server. To be able to bootstrap a node, your workstation needs to have the Chef Development Kit installed. The kit includes the ‘knife’ command that communicates with the Chef server. Your workstation also has to be able to connect to the Chef server with the YOUR_USERNAME.pem file you store in the .chef directory just above your cookbooks.
Bootstrap a Linux node
To bootstrap a Linux node, open a terminal window on your workstation and execute the command:
knife bootstrap MY_NODE_IP -x MY_USERNAME -P MY_PASSWORD --sudo --node-name THE_NODE_NAME --environment THE_ENVIRONMENT --run-list 'recipe[MY_COOKBOOK1::default],recipe[MY_COOKBOOK2::default]'
Bootstrap a Windows node
knife bootstrap windows winrm MY_NODE_IP -x MY_USERNAME -P MY_PASSWORD --node-name THE_NODE_NAME --environment THE_ENVIRONMENT --run-list 'recipe[MY_COOKBOOK1::default],recipe[MY_COOKBOOK2::default]' -V
- MY_NODE_IP is the IP address of the node you want to attach to the Chef server,
- MY_USERNAME and MY_PASSWORD are the credentials to connect to the node.
If the Windows server is in the Windows domain start the username with the domain name MY_DOMAIN\\MY_USERNAME
If the Windows server is not in the domain start the username with the IP address MY_NODE_IP\\MY_USERNAME
- THE_NODE_NAME is the unique name you want the node to use in the Chef server database. If you are bootstrapping a server that lost connectivity to the Chef server or moving the node to another Chef server, find the node name in the node list.
- THE_ENVIRONMENT is the name of the environment the node will run the cookbook in,
- The run list is a list of cookbooks and roles. No spaces are allowed in the string.