vagrant provision成功运行并且vagrant-berkshelf供应商烹饪书但没有安装任何东西

时间:2016-03-21 21:29:44

标签: vagrant chef berkshelf

我正在尝试使用vagrant插件配置vagrant-berkshelf框。我通过运行以下命令创建了一个新的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时,它表示找不到该命令。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

当您通过berkshelf将一大堆烹饪书同步到机器时,您实际运行的唯一食谱是recipe[vagrancy::default]。您可以在Chef输出(Converging 0 resources)中看到这实际上没有做任何事情。您打算将那个配方用于include_recipe其他配方,或者您想要在节点的运行列表中添加更多配方。