once you have the cookbook created, then there will be recipe folder inside the cookbook . you can go on writing as many recipes as you want inside the recipes folder. AFAIK, knife cookbook
does not provide any option for creating a new recipe. check knife cookbook --help
Use knife to create a new recipe in a cookbook
-
30-06-2022 - |
Question
I've used knife solo to create a new folder and a cookbook with a default recipe using a custom template defined by .chef/knife.rb. My question is what command do I use for knife to create new recipes with that template instead of using cp?
Something like knife cookbook addrecipe somerecipe
Solution 2
OTHER TIPS
You can use chef rather than knife for recipe creation.
chef generate recipe cookbooks/test_cookbook new_recipe
Compiling Cookbooks...Recipe: code_generator::recipe[...]
- create new file cookbooks/test_cookbook new_recipe.rb
- update content in file cookbooks/test_cookbook new_recipe.rb from none to 8602b0 (diff output suppressed by config)
knife cookbook create some-recipe -o ./recipe-dir (usually cookbooks)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow