【问题标题】:chef-solo - how do you use resources from a cookbook that doesn't define any recipes?chef-solo - 你如何使用没有定义任何食谱的食谱中的资源?
【发布时间】:2017-05-02 13:52:10
【问题描述】:

对于 chef-solo,您如何使用未定义任何食谱的食谱中的资源?例如:https://github.com/Nordstrom/diskpart-cookbook

我已经把它下载到了本地的 cookbooks/ 文件夹中,我所有的其他食谱依赖项都在其中。我已将其添加到我的 run_list 中,如下所示:

{
  "run_list": [ "recipe[otherstuff]", "recipe[diskpart]" ]
}

但是当我尝试导入它时,例如include_recipe 'diskpart,它只是抱怨它could not find recipe default for cookbook diskpart

我想使用 repo 中定义的资源,例如diskpart_disk

【问题讨论】:

    标签: chef-infra chef-recipe chef-solo


    【解决方案1】:

    使用资源将其添加到食谱的metadata.rb 的依赖项中。

    name 'otherstuff'
    version '1.2.3'
    depends 'diskpart'
    

    这使您无需接触食谱即可使用所有库和资源。

    【讨论】:

    • 我已将此添加到 metadata.rb,但如果我从 run_list 中删除“recipe[diskpart]”,chef-solo 会说不再需要 diskpart 并将其清除。如果我把它留在里面,它仍然会抱怨找不到默认配方。
    • 你是如何收集或下载用于独奏的食谱?
    • 我正在使用 berks 将它们下载到本地的食谱文件夹中。我通过在 Berkfile 中列出它们,然后运行 ​​berks vendor cookbooks 来做到这一点。其中大部分来自超市,但在上面的示例中,我明确引用了 git 存储库。文件结构在 cookbooks 文件夹中看起来完好无损。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    • 2012-03-29
    • 1970-01-01
    • 2018-01-23
    • 2013-03-08
    相关资源
    最近更新 更多