【问题标题】:How to configure chef rbenv and ruby-build cookbooks?如何配置厨师 rbenv 和 ruby​​-build 食谱?
【发布时间】:2014-11-09 09:10:25
【问题描述】:

虽然使用此运行列表进行初始部署时不会引发错误:

"run_list": [ "recipe[ruby_build]", "recipe[rbenv::system_install]", "recipe[main]" ]

...后续部署会引发多个 rsync 错误,例如:

rsync: delete_file: unlink(ruby-build/share/ruby-build/1.9.3-p392) failed: Permission denied (13)

/tmp/chef-solo 的权限似乎设置为 root。

使用knife-solo 配置rbenvruby-build 食谱的正确方法是什么?

编辑:

这个问题真的只是关于如何正确配置和使用这两个cookbook,例如做一个user_install

【问题讨论】:

    标签: chef-infra rhel rbenv knife knife-solo


    【解决方案1】:

    您需要以 root 身份运行 chef-client

    【讨论】:

      【解决方案2】:

      你应该升级刀独奏。 issue 已在 v0.3.0 中修复。您可能想阅读upgrade instructions

      【讨论】:

      • 既然不再有/tmp/chef目录,下面的例子应该引用哪个目录? content IO.read("/tmp/chef-solo/site-cookbooks/main/files/SOME_PATH_TO_FILE")
      • 默认上传是~/chef-solo,但您可以使用配置选项knife[:provisioning_path] 或使用CLI 选项--provisioning-path 覆盖它。直接在你的食谱中阅读它们听起来像是一种反模式。为什么不使用cookbook_file 资源?
      • 在重新访问 [cookbook_file 文档](docs.opscode.com/resource_cookbook_file.html) 之后,我意识到我一直在颠倒 sourcepath 属性。现在我为此目的使用了 cookbook_file 资源。谢谢!
      【解决方案3】:

      我想我使用的是过时的食谱版本。而且我真的不知道运行列表是如何工作的。

      要通过各自的说明书安装 rbenv 和 ruby​​_build,请参阅以下文件配置...

      厨师档案

      site 'http://community.opscode.com/api/v1'
      cookbook 'rbenv', :git => 'https://github.com/fnichol/chef-rbenv', :ref => 'master' 
      cookbook 'ruby_build', :git => 'https://github.com/fnichol/chef-ruby_build', :ref => 'master'
      

      确保在更新 Cheffile 后librarian-chef install

      site-cookbooks/my_cookbook/recipes/default.rb

      depends 'ruby_build'
      depends 'rbenv'
      

      nodes/dna.json

      {
        "rbenv": {
          "rubies":["1.9.3-p484"],
          "global":"1.9.3-p484",
          "gems":{
            "1.9.3-p484":[
              {"name": "bundler"},
              {"name":"rails", "version": "4.0.2"},
              {"name": "rake", "version": "10.1.1"}
            ]
          }
        },
        "run_list":[
          "ruby_build", // required by "rbenv::system"
          "rbenv::system", // installs rubies and gems from dna, takes a while to finish the first time; see configuration options at https://github.com/fnichol/chef-rbenv#attributes
          "my_cookbook::default"
        ]
      }
      

      按照cookbook docs 的建议,使用node.default["var_name"] = "value_name" 在配方中设置这些配置变量对我不起作用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多