How to modify chef node runlist and role through recipe

#1

Hi , I am new to chef and I need suggestion how I can modify node role and runlist based on value from I get from node.chef_environment through recipe

#2

Any help guys ????

#3

I don't think you can modify the run list in a recipe, because the chef run has already started - it's too late. The best you can do is conditionally include recipes based on some attribute like the environment:

include_recipe 'only_in_dev::default' if node.chef_environment == 'dev'