Updating a run list in chef using knife

Anirudh Singh picture Anirudh Singh · Oct 18, 2014 · Viewed 7.9k times · Source

I have cookbook which contains a list of recipes. What is the command to add some specific recipes (not all) from cookbook using command line tool in chef knife?

I know the command to add the whole cookbook to run list which is knife node run_list add server name recipe[cookbook name].

Answer

coderanger picture coderanger · Oct 18, 2014

So you have the right idea, knife node run_list add $nodename $item is the command you want.

recipe[mycookbook] doesn't add "the whole cookbook", instead that is just a shorthand for recipe[mycookbook::default], which in turn maps to mycookbook/recipes/default.rb. Similarly if you have mycookbook/recipes/foo.rb that would be recipe[mycookbook::foo].