knife node show my_chef_node will give you information like the recipes, roles, etc. but ideally what I want is to be able to see the version of those cookbook recipes as well.

knife search node 'recipes:my_cookbook\:\:default' returns nodes but knife search node 'recipes:my_cookbook\:\:[email protected]' does not.

2

There are 2 answers

0
Mark O'Connor On

Unless you constrain the runlist it will be calculated at runtime. Determining this just by looking at the cookbook versions loaded into the server is very hard.

How does one constrain the runlist? One mechanism is to set the version explicitly on the run-list, but this will only partially help as it won't lock the versions of dependencies (unless you've added constraints in your cookbook metadata).

The best approach is to setup Chef environments and associate this with your managed nodes. Use tools to set the cookbook constraints when loading cookbooks. For example using Berkshelf

berks upload
berks apply my-special-runtime-env

Another lessor known approach is using the knife cookbook upload command

knife cookbook upload --all --force --environment my-special-runtime-env

Finally there the option of using the new chef policy file functionality. I have not personally used it, but include it for completeness.

0
Herbert Yu On

Use -a cookbooks . And it works for me:

knife search node 'node-*' -a cookbooks
node-123.server.example.com:
  cookbooks:
    ack:
      version: 7.5.17
    brk:
      version: 6.0.27
...