How to get a list of the recipes applied to Chef node?

chef-infra

Solution

You can accomplish this easily using knife (knife is your friend!).

To get a list of all of your nodes:

knife node list

To get a list of all of your nodes in a given environment:

knife node list --environment <ENVIRONMENT>

With a list of nodes in hand, you can then display details for a node using:

knife node show <NODE_ID>

A knife node show, will display:

Node Name:   
Environment: 
FQDN:        
IP:          
Run List:    
Roles:       
Recipes:     
Platform:    
Tags:   

The Recipes: line is a list of the recipes which have been applied to a node.

Using knife search you can search for a set of nodes which meet specific criteria. Using it, you could find nodes that do or don't have a specific recipe applied to them.

Problem

I want to know if a given recipe has been applied to a list of N nodes managed to Chef. How can I do this easily.

Original source