我正在尝试通过连接到Chef服务器来为Chef配置Vagrant实例。
我的Vagrantfile
看起来与此相似:
Vagrant.configure("2") do |config|
config.vm.box = "opentable/win-2012r2-standard-amd64-nocm"
config.vm.provider = "virtualbox"
config.vm.communicator = "winrm"
config.vm.guest = :windows
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.vm.provision :chef_client do |chef|
chef.chef_server_url = "https://chef.website.com"
chef.validation_key_path = "C:/chef/validation.pem"
chef.run_list = ["recipe[cookbook::default]"]
end
end
根据this documentation,此Vagrantfile
应包含连接到Chef服务器所需的所有字段,并下拉相关的cookbook和数据库。
但是,运行Chef客户端配置程序时遇到以下错误:
The following berks command failed to execute:
C:\opscode\chefdk\embedded\bin/berks.BAT upload --berksfile C:/path/to/cookbook/Berksfile --no-freeze --force
The stdout and stderr are shown below:
stdout: E, [2015-08-10T17:02:57.654352 #8488] ERROR -- : Ridley::Errors::ClientKeyNotFoundOrInvalid: client key is not found or invalid or not found at: 'C:/chef/client.pem'
确实,client.pem
不存在。
虽然错误本身非常自我解释,但我不明白为什么我需要在初始Chef客户端运行时指定client.pem
。
Vagrant有没有办法自己创造这个?更好的是,我可以制作它以便它根本不需要客户端标识符吗?
这只是一个Vagrant实例,所以我不需要在Chef服务器上保留此节点。基于the Chef client provisioner documentation我不明白为什么我需要一个client.pem
文件,因为这些文章没有提到这一点。
感谢您的帮助!
答案 0 :(得分:0)
尝试禁用Berkshelf
config.berkshelf.enabled = false
针对厨师服务器引导新的Chef客户端不需要Berkshelf。 Berkshelf是Chef 工作站上使用的工具,用于管理厨师服务器上的烹饪书。
PS
一个阶段的Vagrant-berkshelf插件deprecated支持Test kitchen。它似乎又回来了,但与此同时,我逐渐意识到测试驱动基础设施的好处!