1

How to get the version of chef-client running on windows node using knife search query ?. For example for linux nodes it is very easy as below will get the desired results.

knife search node "name:xyz" -a name -a ipaddress -a os -a platform -a platform_family -a packages.**chef** -c knife.rb

Is there a similar way for windows nodes ??

Mr.
  • 9,429
  • 13
  • 58
  • 82
vini
  • 87
  • 12

3 Answers3

2

List all endpoints' chef client version:

knife node list | xargs -n 1 knife node show -a chef_packages.chef.version   

List a single endpoint chef client version:

knife node show nodename -a chef_packages.chef.version
Draco Ater
  • 20,820
  • 8
  • 62
  • 86
0

get the chef-client version by execute chef-client --version over ssh. something like:

knife ssh "name:xyz" "chef-client -v" -a name

another way, it to store the chef-client version as a node attribute and then retrive it via search

node.default['chef-client']['version'] = Gem.loaded_specs['chef'].version

or by running chef-client -v and storing it as a node attribute.

you might be also interested in chef-client updater

Mr.
  • 9,429
  • 13
  • 58
  • 82
0

@Mr. : That will be a time consuming activity and also credentials are required. However i found another way of doing it i.e run knife search as below. And filter the results for the required package.

knife search node "name:<name>" -a name -a ipaddress  -a packages  -c knife.rb
Draco Ater
  • 20,820
  • 8
  • 62
  • 86
vini
  • 87
  • 12