chef-client is an agent that runs locally on every node managed by Chef. When
chef-client is run, it will perform all of the steps that are required to converge each node with the expected state defined in their run lists. Clients can be configured to send data to Chef Automate when complete for aggregated, filterable reports collecting results from each client run.
A “chef-client run”, often abbreviated as “CCR”, is the term used to describe the series of steps taken by the chef-client when it is configuring a node. Client runs can be scheduled at regular intervals to ensure that systems always have the latest configurations, and drift is automatically remediated. The following diagram shows the various stages that occur during the chef-client run.
Chef Workstation includes a command-line utility called
knife that can be used to bootstrap new systems for management by Chef. The
knife bootstrap takes the following actions:
- Installs the
chef-clienton the target node(s)
- Configures node(s) for authentication with a Chef Server
- Starts a chef client run to apply user-defined configurations to the target node(s)
Once bootstrapped, nodes can be configured to converge on a regular interval to ensure that any configuration drift is automatically corrected whenever
chef-client is run.
SSH & WinRM
knife bootstrap can bootstrap any server or VM available over SSH or WinRM.
$ knife bootstrap 192.0.2.0 -x username -i ~/.ssh/id_rsa --sudo
Knife plugins are available for integration with cloud providers like Amazon Web Services, Microsoft Azure, and Google Compute Engine
$ knife azurerm server create --azure-resource-group-name MyResourceGrpName --azure-vm-name my-new-vm-name --azure-service-location 'westus' --azure-image-os-type windows -x myuser -P mypassword -c ~/.chef/knife.rb
Chef Workstation includes the
chef-run utility, which can apply Chef configurations directly as a one time, ad-hoc task without requiring a Chef Server.
$ chef-run -i ~/.ssh/mykey server1,server2,server3 package nginx action=install
Learn Chef Rally is an invaluable library of self-paced learning resources.