Search code examples
chef-infrachef-recipechef-soloknifecookbook

How to get list of nodes list alongwith the roles and recipes assigned in the runlist within a particular chef environment?


I am using the following command to get list of nodes in a particular environment.

knife node list -e env1

How can I modify knife command to also include the run list items within it?


Solution

  • You wouldn't use knife node list for this. Most knife commands are very direct wrappers for their underlying REST API calls. If you want to build a script for displaying in a particular format, you probably want to use knife exec or skip knife entirely and use something like the chef-api gem or PyChef Python library.