Information Technology Reference
In-Depth Information
Use a question mark (“?”) to match any single character:
knife search node "platform_version:14.0?"
You can add specific key-value pairs in the query part of the knife search command line.
The following query will return the item where node == snowman :
$ knife search node "hostname:snowman"
1 items found
Node Name: snowman
Environment: _default
FQDN: snowman.playground.local
IP: 192.168.33.32
Run List: recipe[apache], recipe[motd], recipe[motd-attributes]
Roles:
Recipes: apache, motd, motd-attributes
Platform: ubuntu 14.04
Tags:
NOTE
To obtain a list of attribute names to use in a search, run the knife <index> show com-
mand using the --long option. It will show you all the available attributes. For example,
we ran the following command to determine that the attribute for Node Name: was host-
name :
knife node snowman --long
Note that our test data doesn't include all the possible attributes. You'll need to run knife
node show against a real Chef Server setup. Another way to collect this information for a
node without needing a real setup is to run ohai and look through the results. Most of the
attributes about a node come from ohai .
Multiple key-value pairs can be specified using boolean values, such as OR. For example,
the following query would return the items where the id is alice OR bob :
Search WWH ::




Custom Search