我有一套用于配置 Web 和 SQL 服务器的说明书,它们目前用于我们的持续部署管道。我希望开发人员能够使用相同的说明书来设置他们的本地开发环境,而无需向厨师服务器注册每台开发机器。似乎可以使用厨师零来完成此操作,但是我在开始使用它时遇到了一些麻烦。
我有一个 chef-repo 文件夹,里面有我的食谱,我按照本文中的步骤进行操作。
PS C:\Temp\chef-repo> tree .
Folder PATH listing
Volume serial number is 3E77-463C
C:\TEMP\CHEF-REPO
└───cookbooks
└───test
└───recipes
PS C:\Temp\chef-repo> cat .\cookbooks\test\recipes\default.rb
file "C:\Temp\test.log" do
content 'HELLO WORLD'
end
但是,当我运行时chef-client -z -o test
,它似乎无法找到我的食谱。
这是我得到的错误:
Starting Chef Client, version 11.16.0
[2014-09-25T10:17:37-05:00] WARN: Run List override has been provided.
[2014-09-25T10:17:37-05:00] WARN: Original Run List: []
[2014-09-25T10:17:37-05:00] WARN: Overridden Run List: [recipe[test]]
resolving cookbooks for run list: ["test"]
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: test
Expanded Run List:
------------------
* test
Running handlers:
[2014-09-25T10:17:37-05:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-25T10:17:37-05:00] ERROR: Exception handlers complete
[2014-09-25T10:17:37-05:00] FATAL: Stacktrace dumped to C:/Users/username/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 25.375311 seconds
[2014-09-25T10:17:38-05:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed "
我从 运行此命令C:\Temp\chef-repo
,这是我的厨师存储库文件夹的根目录。我还尝试修改 my%USERPROFILE%\.chef\knife.rb
以包含以下设置:
cookbook_path [
"C:\Temp\chef-repo\cookbooks"
]
local_mode true
node_name "Chef.example.com"
我究竟做错了什么?