meallhour
meallhour

Reputation: 15571

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?

Upvotes: 0

Views: 4856

Answers (3)

Chen Shabi
Chen Shabi

Reputation: 174

This will get you half way, all nodes with their run list. You can also filter with the "environment/env" attribute

knife search node "*" -a run_list

Upvotes: 0

CodeRunner
CodeRunner

Reputation: 21

Try the following:

knife search node "roles:$ROLENAME"

Upvotes: 1

coderanger
coderanger

Reputation: 54181

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.

Upvotes: 2

Related Questions