我是一名 Vagrant n00b,在使用 chef-solo 设置一个非常简单的 CentOS LAMP 盒时,我遇到了让 Vagrant 和 Chef 的 knife
命令一起玩得很好的问题。
这里是这个问题的简要概述:
<醇>knife cookbook site install nameofcookbook
下载了所有的 Recipe ,使用的配置将它们放在 ./chef/cookbooks
中。vagrant up
您可以在 this gist 中查看基础知识.当我运行 vagrant provision
时出现这样的错误
The chef binary (either `chef-solo` or `chef-client`) was not found on the VM and is required for chef provisioning. Please verify that chef is installed and that the binary is available on the PATH.
当我运行 vagrant halt
时,我收到一条错误消息,提示 ssh 命令退出时出现非零错误代码。
vagrant ssh
,并确认 (a) chef-solo 实际上存在于框中,并且 (b) 我可以通过框中的命令行关闭.vagrant up
时,出现如下错误:
The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! mkdir -p /vagrant</li>
我做错了什么?
非常感谢任何帮助,我对深入研究 Vagrant 感到非常兴奋!
最佳答案
chef.add_recipe "sudo"
在第一次运行后修改你的 sudo 文件。
将适当的 json 添加到您的 vagrant 用户的 vagrant 文件中。
类似于:
config.vm.provision :chef_solo do |chef|
# add your recipes
# chef.add_recipe "foo"
# chef.add_role "bar"
chef.json = {
"authorization" => {
"sudo" => {
"users" => [ "vagrant" ],
"passwordless" => true,
}
}
}
end
关于centos - Knife Cookbook 安装后 Vagrant Box 损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13124564/