Search the Chef server

Use the knife search command to list nodes that match the provided criteria

Find nodes with a specific cookbook in the run list (runlist)

knife search node 'recipes:MY_COOKBOOK\:\:*'

Find nodes with a specific recipe in the run list (runlist)

knife search node 'recipes:MY_COOKBOOK\:\:MY_RECIPE'

List nodes with a specific OS

All Linux nodes

knife search node "os:linux"

All nodes with Ubuntu OS

knife search node 'platform:ubuntu'

The last time the node successfully executed the run list (checked in)

List the status of all nodes and save it in a file. The columns contain how long ago the node successfully executed the run list, the name of the node, and the operating system.

knife status > nodes.csv

List nodes attached to a specific Policy Group and display the ‘ec2.instance_id’ attribute only

knife search 'policy_group:dev' -a ec2.instance_id

Display all information about a node

knife node show <FQDN> -l

List all nodes and display the Policy Group attribute only

knife search node 'name:*' -a policy_group

Leave a comment

Your email address will not be published.