【问题标题】:Check if chef is running as chef-solo检查 chef 是否以 chef-solo 身份运行
【发布时间】:2013-02-24 16:36:29
【问题描述】:

我正在使用 Vagrant 和 chef-solo 来测试我的食谱,但我有一个需要 chef-server 的特定食谱(它使用搜索)。我希望我的默认食谱如下所示:

include_recipe 'some_recipe'
include_recipe 'some_other_recipe'
unless running_as_chef_solo?
  include_recipe 'a_recipe_that_requires_chef_server'
end

如何检查厨师是否在食谱中以厨师独奏的身份运行,以便跳过不受支持的食谱?

【问题讨论】:

    标签: chef-infra vagrant chef-recipe


    【解决方案1】:

    使用Chef::Config 对象:

    unless Chef::Config[:solo]
      include_recipe 'a_recipe_that_requires_chef_server'
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-25
      • 1970-01-01
      • 2015-04-01
      • 1970-01-01
      • 2023-03-31
      • 2023-03-04
      相关资源
      最近更新 更多