流浪厨师,找不到文件夹
Chef Vagrant, Can't Find Folder
大厨真是把我搞糊涂了。你能帮我理解为什么它不起作用吗?
悬崖笔记
- 我正在使用 Chef-Solo(不是 Berkshelf 或其他任何软件)
- 当我从头开始设置时一切正常,我可以
vagrant provision
- 但是,如果我重新启动 HOST(我的主要操作系统),它就会崩溃!
- 它似乎在我没有在 vagrant 配置中指定的 .chef 文件夹中查找。
- 如果我重新启动,我必须执行
vmboxmanage box destroy ubuntu/trusty64
并重新下载所有内容并重做 vagrant up
。
- Vagrant 版本 1.7.2
- 虚拟盒子版本 4.3.20r96996
Vagrant SSH 内部错误:
注意:文件没有指向 .chef
文件夹,但它们在这里?
[2015-01-30T16:23:44+00:00] WARN: Did not find config file:
/etc/chef/solo.rb, using command line options.
[2015-01-30T16:23:50+00:00] FATAL: None of the cookbook paths set in
Chef::Config[:cookbook_path],
["/vagrant/.chef/cookbooks", "/vagrant/.chef/site-cookbooks"],
contain any cookbooks
$vagrant up 和 $vagrant provision 错误:
==> default: Mounting shared folders...
default: /vagrant => /home/jesse/if/indieflix/vagrant
default: /home/vagrant/chef-recipes => /home/jesse/projects/if/vagrant/chef-recipes
default: /home/vagrant/chef-resources => /home/jesse/projects/if/vagrant/chef-resources
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Shared folders that Chef requires are missing on the virtual machine.
This is usually due to configuration changing after already booting the
machine. The fix is to run a `vagrant reload` so that the proper shared
folders will be prepared and mounted on the VM.
而且,vagrant reload
什么都不做。
Vagrantfile
# ...
config.vm.synced_folder "chef-recipes", "/vagrant/chef-recipes"
config.vm.synced_folder "chef-resources", "/vagrant/chef-resources"
# ...
config.vm.provision "chef_solo" do |chef|
# Relevant to the Vagrantfile path
chef.cookbooks_path = ["chef-recipes"]
# This is just required by Chef, so it's minimal
chef.environments_path = "chef-resources/environments"
# This is the internal flag.
chef.environment = "development"
# This defines the cookbooks to run
chef.roles_path = "chef-resources/roles"
chef.add_role("development")
end
文件夹结构
chef-recipes/ (Git Submodule)
----python/
--------recipes/
------------default.rb
------------pip.rb
chef-resouces/ (Git Submodule)
----environments/
--------development.json
----roles/
--------development.json
Vagranfile
Anthony 在评论中建议我回答我的问题,因为它在评论中得到了回答。在这里!
我没有使用 curl 安装,而是使用了 omnibus,它在配置之前添加了另一个步骤:
$ vagrant plugin install vagrant-omnibus
其次,Chef-Solo/Vagrant 从主机加载文件时出现问题。我找到的唯一解决方法是:
$ rm .vagrant/machines/default/virtualbox/synced_folders vagrant reload --provision
可选: 我创建了一个 bash 脚本来使上面的操作更快一些:
reprovision.sh
#/bin/bash
rm .vagrant/machines/default/virtualbox/synced_folders
vagrant reload --provision
当然还有 chmod +x reprovision.sh
和 运行 ./reprovision.sh
大厨真是把我搞糊涂了。你能帮我理解为什么它不起作用吗?
悬崖笔记
- 我正在使用 Chef-Solo(不是 Berkshelf 或其他任何软件)
- 当我从头开始设置时一切正常,我可以
vagrant provision
- 但是,如果我重新启动 HOST(我的主要操作系统),它就会崩溃!
- 它似乎在我没有在 vagrant 配置中指定的 .chef 文件夹中查找。
- 如果我重新启动,我必须执行
vmboxmanage box destroy ubuntu/trusty64
并重新下载所有内容并重做vagrant up
。 - Vagrant 版本 1.7.2
- 虚拟盒子版本 4.3.20r96996
Vagrant SSH 内部错误:
注意:文件没有指向 .chef
文件夹,但它们在这里?
[2015-01-30T16:23:44+00:00] WARN: Did not find config file:
/etc/chef/solo.rb, using command line options.
[2015-01-30T16:23:50+00:00] FATAL: None of the cookbook paths set in
Chef::Config[:cookbook_path],
["/vagrant/.chef/cookbooks", "/vagrant/.chef/site-cookbooks"],
contain any cookbooks
$vagrant up 和 $vagrant provision 错误:
==> default: Mounting shared folders...
default: /vagrant => /home/jesse/if/indieflix/vagrant
default: /home/vagrant/chef-recipes => /home/jesse/projects/if/vagrant/chef-recipes
default: /home/vagrant/chef-resources => /home/jesse/projects/if/vagrant/chef-resources
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Shared folders that Chef requires are missing on the virtual machine.
This is usually due to configuration changing after already booting the
machine. The fix is to run a `vagrant reload` so that the proper shared
folders will be prepared and mounted on the VM.
而且,vagrant reload
什么都不做。
Vagrantfile
# ...
config.vm.synced_folder "chef-recipes", "/vagrant/chef-recipes"
config.vm.synced_folder "chef-resources", "/vagrant/chef-resources"
# ...
config.vm.provision "chef_solo" do |chef|
# Relevant to the Vagrantfile path
chef.cookbooks_path = ["chef-recipes"]
# This is just required by Chef, so it's minimal
chef.environments_path = "chef-resources/environments"
# This is the internal flag.
chef.environment = "development"
# This defines the cookbooks to run
chef.roles_path = "chef-resources/roles"
chef.add_role("development")
end
文件夹结构
chef-recipes/ (Git Submodule)
----python/
--------recipes/
------------default.rb
------------pip.rb
chef-resouces/ (Git Submodule)
----environments/
--------development.json
----roles/
--------development.json
Vagranfile
Anthony 在评论中建议我回答我的问题,因为它在评论中得到了回答。在这里!
我没有使用 curl 安装,而是使用了 omnibus,它在配置之前添加了另一个步骤:
$ vagrant plugin install vagrant-omnibus
其次,Chef-Solo/Vagrant 从主机加载文件时出现问题。我找到的唯一解决方法是:
$ rm .vagrant/machines/default/virtualbox/synced_folders vagrant reload --provision
可选: 我创建了一个 bash 脚本来使上面的操作更快一些:
reprovision.sh
#/bin/bash
rm .vagrant/machines/default/virtualbox/synced_folders
vagrant reload --provision
当然还有 chmod +x reprovision.sh
和 运行 ./reprovision.sh