问题
I want to find out if a specific recipe will be run on a node from inside a different recipe. I can node.recipe?(recipe_name) method, however some of my recipies are managed by roles and recipe? does not seem to look into the roles run list.
Is there an easy way to find out if my recipie[redis] is going to be run on the current node?
回答1:
You're looking for the recipes
method. Note the trailing s
! So:
node.recipes.include?(recipe_name)
Also note that there is a similar pair of methods for role inspection. Those are role
and roles
. For both roles and recipes, the singular form is for those directly assigned and the plural for the fully resolved set.
来源:https://stackoverflow.com/questions/17330553/chef-node-check-if-recipe-will-run-on-it-looking-inside-roles-as-well