我正在尝试在 Chef Supermarket 中使用最新版本的 mysql Recipe :
https://supermarket.chef.io/cookbooks/mysql
(8.3.1)
我已将其添加为包装 Recipe ,并创建了一个我试图在 Test Ktichen 中旋转的小 Recipe :
include_recipe 'mysql'
mysql_service 'foo' do
port '3306'
version '5.7'
initial_root_password 'change me'
action [:create, :start]
end
mysql_config 'logging' do
instance 'instance-1'
source 'my.cnf.erb'
action :create
notifies :restart, 'mysql_service[instance-1]'
end
这很快就会失败:
could not find recipe default for cookbook mysql
依赖的“mysql”位于说明书metadata.rb中。
我看到一些帖子说这本 Recipe 已经进行了重大重构...但我仍然不知道如何实际使用它...
最佳答案
安include_recipe
方法用于调用指定的配方。如果没有给出配方,例如include_recipe '<cookbook_name>'
,它将调用默认配方,即default.rb。
https://docs.chef.io/recipes.html#include-recipes
就您而言,mysql
是一本基础 Recipe ,只有在 Wrapper Recipe 中使用的库和资源。因此,您可以调用类似 mysql_config
的资源。但是include_recipe
将会失败,因为该 Recipe 中没有 Recipe 。
关于mysql - 如何使用 mysql Recipe ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43371860/