vagrant provision 成功运行并且 vagrant-berkshelf vendors cookbooks 但没有安装任何东西

vagrant provision runs successfully and vagrant-berkshelf vendors cookbooks but nothing is installed

我正在尝试使用 vagrant-berkshelf 插件提供一个 vagrant 盒子。我通过 运行 执行以下命令创建了一个新的 berks 驱动的食谱:berks cookbook vagrancy 然后将我想要的食谱(例如 gitrvm)添加到生成 Berksfile

我的 Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'

Vagrant.require_version '>= 1.5.0'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.hostname = 'vagrancy-berkshelf'

  if Vagrant.has_plugin?("vagrant-omnibus")
    config.omnibus.chef_version = 'latest'
  end

  config.vm.box = 'bento/centos-6.7'

  config.vm.network :private_network, type: 'dhcp'

  config.vm.synced_folder "~/repos", "/repos"

  config.berkshelf.enabled = true

  config.vm.provision :chef_solo do |chef|
    chef.json = {
      rvm: {
        user_installs: [{
          user: 'vagrant',
          default_ruby: '2.3.0',
          global_gems: [{
            name: 'bundler'
          }]
        }]
      }
    }

    chef.run_list = [
      'recipe[vagrancy::default]'
    ]
  end
end

我的 Berksfile:

source "https://supermarket.chef.io"

metadata

cookbook 'build-essential'
cookbook 'yum'
cookbook 'git'
cookbook 'rvm'
cookbook 'nodejs'
cookbook 'python'

cookbook 'tmux'
cookbook 'vim'

我运行vagrant provision时的输出:

$ vagrant provision
==> default: Loading Berkshelf datafile...
==> default: Sharing cookbooks with VM
==> default: Updating Vagrant's Berkshelf...
==> default: Resolving cookbook dependencies...
==> default: Fetching 'vagrancy' from source at .
==> default: Using 7-zip (1.0.2)
==> default: Using ark (1.0.1)
==> default: Using apt (3.0.0)
==> default: Using build-essential (2.4.0)
==> default: Using chef_handler (1.3.0)
==> default: Using chef_gem (0.1.0)
==> default: Using dmg (2.3.0)
==> default: Using git (4.3.7)
==> default: Using homebrew (2.0.5)
==> default: Using java (1.39.0)
==> default: Using nodejs (2.4.4)
==> default: Using python (1.4.6)
==> default: Using rvm (0.9.4)
==> default: Using seven_zip (2.0.0)
==> default: Using tmux (1.5.0)
==> default: Using vagrancy (0.1.0) from source at .
==> default: Using windows (1.39.2)
==> default: Using vim (2.0.1)
==> default: Using yum (3.10.0)
==> default: Using yum-epel (0.6.6)
==> default: Vendoring 7-zip (1.0.2) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/7-zip
==> default: Vendoring apt (3.0.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/apt
==> default: Vendoring ark (1.0.1) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/ark
==> default: Vendoring build-essential (2.4.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/build-essential
==> default: Vendoring chef_gem (0.1.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/chef_gem
==> default: Vendoring chef_handler (1.3.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/chef_handler
==> default: Vendoring dmg (2.3.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/dmg
==> default: Vendoring git (4.3.7) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/git
==> default: Vendoring homebrew (2.0.5) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/homebrew
==> default: Vendoring java (1.39.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/java
==> default: Vendoring nodejs (2.4.4) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/nodejs
==> default: Vendoring python (1.4.6) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/python
==> default: Vendoring rvm (0.9.4) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/rvm
==> default: Vendoring seven_zip (2.0.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/seven_zip
==> default: Vendoring tmux (1.5.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/tmux
==> default: Vendoring vagrancy (0.1.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/vagrancy
==> default: Vendoring vim (2.0.1) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/vim
==> default: Vendoring windows (1.39.2) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/windows
==> default: Vendoring yum (3.10.0) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/yum
==> default: Vendoring yum-epel (0.6.6) to /Users/mueller128/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160321-4742-1l5l6ts-default/yum-epel
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
==> default: Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: [2016-03-21T21:27:41+00:00] INFO: Forking chef instance to converge...
==> default: Starting Chef Client, version 12.9.0
==> default: [2016-03-21T21:27:41+00:00] INFO: *** Chef 12.9.0 ***
==> default: [2016-03-21T21:27:41+00:00] INFO: Chef-client pid: 5659
==> default: [2016-03-21T21:27:42+00:00] INFO: Setting the run_list to ["recipe[vagrancy::default]"] from CLI options
==> default: [2016-03-21T21:27:42+00:00] INFO: Run List is [recipe[vagrancy::default]]
==> default: [2016-03-21T21:27:42+00:00] INFO: Run List expands to [vagrancy::default]
==> default: [2016-03-21T21:27:42+00:00] INFO: Starting Chef Run for vagrant-9a1b8405
==> default: [2016-03-21T21:27:42+00:00] INFO: Running start handlers
==> default: [2016-03-21T21:27:42+00:00] INFO: Start handlers complete.
==> default: Installing Cookbook Gems:
==> default: Compiling Cookbooks...
==> default: Converging 0 resources
==> default: [2016-03-21T21:27:43+00:00] INFO: Chef Run complete in 0.924325387 seconds
==> default: [2016-03-21T21:27:43+00:00] INFO: Skipping removal of unused files from the cache
==> default:
==> default: Running handlers:
==> default: [2016-03-21T21:27:43+00:00] INFO: Running report handlers
==> default: Running handlers complete
==> default:
==> default: [2016-03-21T21:27:43+00:00] INFO: Report handlers complete
==> default: Chef Client finished, 0/0 resources updated in 02 seconds

但是,当我 运行 vagrant ssh 并键入 git 时,它说找不到命令。

感谢所有帮助。

虽然您有一大堆食谱通过 berkshelf 同步到机器,但您实际上 运行 唯一的食谱是 recipe[vagrancy::default]。您可以在 Chef 输出 (Converging 0 resources) 中看到这实际上没有执行任何操作。要么您打算将一个配方用于 include_recipe 其他配方,要么您想要将更多配方添加到节点的 运行 列表中。