0
votes

Is there a way to tell a chef node to run all the recipe files in a cookbook without having to manually add each one to the runlist or perform some other manual task from the workstation?

I suspect that there may be a way to query the list of available recipes at chef-client execution time, but I don't know what the ruby command/syntax would be.

2
Directory listing saved to a file? Try find /recipes/directory -type f -maxdepth 1 >> runlist.file or whatever is appropriate for chef. - bgStack15
First idea coming to my mind is to create a script which will add include_recipes into the default recipe for each recipe of the cookbook. in a 'bash' way: for f in `ls -I default.rb -1`; do echo "include_recipe 'cookbook::$f'"; done > default.rb This mean default recipe should have only these inclusions, if you have code in ti, move it to anotehr recipe. (But that sounds a bad pattern) - Tensibai

2 Answers

0
votes

There is nothing in particular for this that wouldn't be touching many internal APIs. It probably means that you have too many recipes in the cookbook though. What are you trying to do?

0
votes

add below line in default recipe (default.rb) of your cookbook.

include_recipe "cookbook::recipe"

Include all recipes like that and now run chef client by adding only cookbook name to the runlist (don't mention recipes or you can mention default recipe. either way it'll work)