chef-infra - 如何为 Chef 本地模式指定 chef_environment (chef-client -z)

标签 chef-infra chef-zero

我已经将 Chef 文件从我的 Chef 服务器复制到本地客户端节点,在 ~/.chef 下,我在 ~/.chef/environments 下有所有环境,例如development.rb, production.rb

当我从 ~/.chef/ 下运行 chef-client -z -E development -r 'recipe[cookbook_foo::recipe_bar]' 时,我收到此错误:

================================================================================
Error expanding the run_list:
================================================================================

Unexpected API Request Failure:
-------------------------------
Object not found: http://localhost:8889/environments/development

如果我在没有 -E development 的情况下运行命令,一切正常。但是,我需要传递环境名称,因为该 Chef Recipe 中使用了 #{node.chef_environment} 变量。 Google 没有就此问题向我提供答案:/

我正在使用 Chef 客户端 11.16.4

有什么想法吗?

最佳答案

不幸的是,零号 Chef 不理解.rb DSL 文件。您需要将环境文件转换为 .json 才能将它们与 Chef Zero 一起使用。

关于chef-infra - 如何为 Chef 本地模式指定 chef_environment (chef-client -z),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27989483/

相关文章:

apache2 - Chef 属性节点[:languages] vanishes after first chef-client run

ruby - 如果源文件存在,如何编写 Chef 配方来复制文件? only_if 守卫不工作

Vagrant 与 Chef Zero 在初始启动时失败,但在后续配置中成功

powershell - Chef 提高powershell_script性能

ruby - 在 Chef 模板 (ERB) 中循环遍历数组

powershell - Mixlib::ShellOut - Windows 模拟失败

ssh - Chef : deploy a server with root ssh access disabled?