【问题标题】:what is the proper way to override chef recipe attributes?覆盖厨师食谱属性的正确方法是什么?
【发布时间】:2014-12-31 16:26:33
【问题描述】:

我正在添加这个 Solr Chef recipeexisting vagrant box 。我想覆盖版本属性 here 。我是在其中一个 json 文件中覆盖这些变量,还是必须在配方属性文件本身中覆盖这些变量?

【问题讨论】:

    标签: vagrant chef-infra


    【解决方案1】:

    对于您的用例,可以直接在 Vagrantfile 中覆盖它。查看更多关于 chef solo 和 vagrant here 的信息。

    tldr;

    只需在您的 Vagrantfile 中提供带有属性的 chef.json 选项,例如:

    Vagrant.configure("2") do |config|
      config.vm.provision "chef_solo" do |chef|
    # ...
        chef.json = {
         "solr" => {
           "version" => "4.6.1"
          }
        }
      end
    end
    

    在一般实践中,通常在角色内部设置属性,或者在社区属性周围创建wrapper cookbooks,这样就无需更改原始源代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-21
      • 1970-01-01
      • 2015-05-04
      • 2015-02-16
      • 2023-03-22
      • 2015-05-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多