2016-03-21 51 views
0

我想提供一個vagrant框使用vagrant-berkshelf插件。我通過運行以下命令創建了一個新的berks -powered食譜:berks cookbook vagrancy,然後將我所需的食譜(例如git,rvm)添加到生成的Berksfile流浪漢提供成功運行和流浪berkshelf供應商cookbooks,但沒有安裝

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 sshgit它表示找不到命令。

感謝您的幫助。

回答

1

雖然你有一大堆食譜通過berkshelf同步到機器,但實際運行的唯一配方是recipe[vagrancy::default]。您可以在廚師輸出(Converging 0 resources)中看到這實際上沒有做任何事情。要麼你打算將其中一個配方設置爲include_recipe,要麼將其他設置添加到節點的運行列表中。

+0

是的,我終於明白,Berkshelf只適用於售賣食譜,並不實際安裝它們。通過添加食譜廚師運行列表(這不是一個烹飪隱喻順便說一句),當我配備我的流浪者箱子時,食譜像git安裝。 –