Please see KBEC-00293 - How to Set up a Chef Server and Workstation for Installation of Chef Server and Workstation
This write-up includes steps to:
- Uploading Chef cookbooks to the Server
- Bootstrapping a node
Uploading Cookbooks to the Chef Server:
Once the workstation is ready, we can upload cookbooks to the Chef Server. These cookbooks will be used to configure the machines. There are several community cookbooks which can be downloaded from this site:
The root directory of any downloaded cookbook will go in the ~/chef-repo/cookbooks directory. For instance, this screenshot shows 4 cookbooks – java, openssl, sample-httpd and tomcat – on the workstation.
To upload the, say, the openssl cookbook to the Chef Server, this command can be used:
sudo knife cookbook upload openssl
Once a cookbook is present on the Chef Server, this can be used to configure any machine. Note that you will need to be in the ~/chef-repo directory to run any of the knife commands.
Bootstrapping and Configuring a Node:
“Bootstrapping” is a term which denotes the process of registering a machine with the Chef Server so that it can be configured. This is done by installing chef-client on the machine (referred to as “target” or “node” in Chefspeak) and wiring it up so that you can run recipes or roles on it from your workstation.
The command to bootstrap a target is:
knife bootstrap <machine IP address or FQDN> (options)
One could configure a node at the time of bootstrapping by running a list of roles or recipes (called a Run List). This can be done by including the Run List as an option in the knife bootstrap command. For instance:
sudo knife bootstrap sampleNode --r ‘recipe[openssl],recipe[java]’
The node has now been bootstrapped and configured!