首页 文章

厨师Vagrant,找不到文件夹

提问于
浏览
2

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

Cliff Notes

  • 我正在使用Chef-Solo(不是Berkshelf或其他任何东西)

  • 当我从头开始设置时,一切正常,我可以 vagrant provision

  • 但是,如果我重新启动 HOST (我的主要操作系统),它会中断!

  • 它似乎是在我的流浪汉配置中未指定的.chef文件夹中查找 .

  • 如果我重新启动,我必须做 vmboxmanage box destroy ubuntu/trusty64 并重新下载所有内容并重做 vagrant up .

  • Vagrant Version 1.7.2

  • Virtual Box版本4.3.20r96996

Inside Vagrant SSH Error:

注意:文件未指向 .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 and $ 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

Folder Structure

chef-recipes/    (Git Submodule)
----python/
--------recipes/
------------default.rb
------------pip.rb
chef-resouces/   (Git Submodule)
----environments/
--------development.json
----roles/
--------development.json
Vagranfile

1 回答

  • 4

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

    我没有使用curl来安装,而是使用了omnibus,它在配置之前增加了另一个步骤:

    $ vagrant plugin install vagrant-omnibus
    

    其次,Chef-Solo / Vagrant在从主机安装文件时遇到问题 . 我发现的唯一解决方法是:

    $ rm .vagrant/machines/default/virtualbox/synced_folders vagrant reload --provision
    

    Optional: 我创建了一个bash脚本,使上面的内容更快一些:

    reprovision.sh

    #/bin/bash
    rm .vagrant/machines/default/virtualbox/synced_folders
    vagrant reload --provision
    

    当然 chmod +x reprovision.sh 并运行 ./reprovision.sh

相关问题