厨师Vagrant,无法找到文件夹

时间:2015-01-30 16:38:59

标签: vagrant chef chef-solo vagrantfile

厨师真让我困惑。你能帮我理解为什么它不起作用吗?

悬崖笔记

  • 我正在使用Chef-Solo(不是Berkshelf或其他任何东西)
  • 当我从头开始设置时,一切正常,我可以vagrant provision
  • 但如果我重新启动 HOST (我的主要操作系统),它会中断!
  • 它似乎是在我的流浪汉配置中未指定的.chef文件夹中查找。
  • 如果我重新启动,我必须执行vmboxmanage box destroy ubuntu/trusty64并重新下载所有内容并重做vagrant up
  • Vagrant Version 1.7.2
  • Virtual Box版本4.3.20r96996

内部流氓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 error:

==> 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

1 个答案:

答案 0 :(得分:4)

安东尼在评论中建议我回答我的问题,因为它已在评论中得到回答。在这里!

我没有使用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