Vagrant 流浪厨师,罐头';找不到文件夹

Vagrant 流浪厨师,罐头';找不到文件夹,vagrant,chef-infra,chef-solo,vagrantfile,Vagrant,Chef Infra,Chef Solo,Vagrantfile,厨师真把我弄糊涂了。你能帮我理解为什么它不起作用吗 悬崖笔记 我用的是厨师独奏(不是Berkshelf或其他任何东西) 当我从头开始设置它时,一切都正常,我可以流浪准备金 但是如果我重新启动主机(我的主操作系统),它就会坏掉 它似乎在一个.chef文件夹中查找,我在vagrant配置中没有指定该文件夹 如果我重新启动,我必须执行一个vmboxmanagebox销毁ubuntu/trusty64并重新下载所有内容并重新执行vagrant up 流浪者版本1.7.2 虚拟盒版本4.3.20r969

厨师真把我弄糊涂了。你能帮我理解为什么它不起作用吗

悬崖笔记

  • 我用的是厨师独奏(不是Berkshelf或其他任何东西)
  • 当我从头开始设置它时,一切都正常,我可以
    流浪准备金
  • 但是如果我重新启动主机(我的主操作系统),它就会坏掉
  • 它似乎在一个.chef文件夹中查找,我在vagrant配置中没有指定该文件夹
  • 如果我重新启动,我必须执行一个
    vmboxmanagebox销毁ubuntu/trusty64
    并重新下载所有内容并重新执行
    vagrant up
  • 流浪者版本1.7.2
  • 虚拟盒版本4.3.20r96996
内部游荡SSH错误:

==> 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.
注意:文件没有指向
.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拨备错误:

==> 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
什么也不做

流浪汉档案

# ...
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
文件夹结构

# ...
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

安东尼在评论中建议我回答我的问题,因为我的问题在评论中得到了回答。给你

我没有使用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+xreprovision.sh
和在重新启动主机时运行
/reprovision.sh

?哪位主持人?虚拟机还是主机?可能是重新启动后virtualbox中的计算机的引用发生了更改吗?我不确定,但我怀疑存储在.vagrant目录中的该计算机的id不是重新启动后virtualbox中来宾的id,这就是为什么vagrant无法使用vagrant reload装载共享文件夹的原因。您应该在重新启动后通过vagrant重新启动VM(使用
vagrant up
,它将搜索VM并打开电源,获取新id并装入正确的文件夹,我认为)。当您执行vagrant配置时,它将生成一个solo.rb文件、一个json文件和一些其他文件,然后使用一些参数运行chef solo。当您只是在命令行中运行chef solo时,它将搜索默认配置文件,因为vagrant没有创建该文件。我没有使用chef solo,所以我可能错了,但路径似乎是:
vagrant up;流浪重新装载;vagrant provision
(可能不需要up),但您必须让vagrant装载共享文件夹并管理chef运行,否则您必须在ssh会话中模拟它。我想补充一点,如果有人遇到此问题,chef Solo/vagrant在主机上装载文件时似乎存在错误。我找到的唯一解决方法是:
rm.vagrant/machines/default/virtualbox/synced_folders vagrant reload-provision
@JREAM您的评论就是答案。我建议你回答自己的问题,并接受这个答案。它将帮助其他SOER伙伴