2015-02-11 64 views
1

我試圖與廚師'iis'的食譜和流浪漢管理Windows Web服務器。廚師獨奏無法找到與流浪漢和Windows的食譜

當我嘗試運行廚師獨奏時,它會拋出找不到食譜的錯誤。

錯誤消息:

sowens-MBP:vagrant-windows sowen$ vagrant provision 
==> default: Running provisioner: chef_solo... 
==> default: Vagrant does not support detecting whether Chef is installed 
==> default: for the guest OS running in the machine. Vagrant will assume it is 
==> default: installed and attempt to continue. 
Generating chef JSON and uploading... 
==> default: Running chef-solo... 
==> default: [2015-02-10T16:18:24-08:00] INFO: *** Chef 12.0.3 *** 
==> default: [2015-02-10T16:18:24-08:00] INFO: Chef-client pid: 2508 
==> default: [2015-02-10T16:18:30-08:00] INFO: Setting the run_list to ["recipe[example-webserver2012]"] from CLI options 
==> default: 
==> default: [2015-02-10T16:18:30-08:00] INFO: Run List is [recipe[example-webserver2012]] 
==> default: [2015-02-10T16:18:30-08:00] INFO: Run List expands to [example-webserver2012] 
==> default: [2015-02-10T16:18:30-08:00] INFO: Starting Chef Run for vagrant-2012-r2.nv.com 
==> default: [2015-02-10T16:18:30-08:00] INFO: Running start handlers 
==> default: [2015-02-10T16:18:30-08:00] INFO: Start handlers complete. 
==> default: [2015-02-10T16:18:30-08:00] ERROR: Running exception handlers 
==> default: 
==> default: [2015-02-10T16:18:30-08:00] ERROR: Exception handlers complete 
==> default: [2015-02-10T16:18:30-08:00] FATAL: Stacktrace dumped to C:/var/chef/cache/chef-stacktrace.out 
==> default: [2015-02-10T16:18:30-08:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook iis not found. If you're loading iis from another cookbook, make sure you configure the dependency in your metadata 
Chef never successfully completed! Any errors should be visible in the 
output above. Please fix your recipes so that they properly complete. 

Vagrantfile:

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

VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(2) do |config| 
    config.vm.box = "lmayorga1980/windows-2012r2" 
    config.vm.communicator = "winrm" 
    config.vm.network "forwarded_port", host: 3389, guest: 3389 
    config.vm.provider "virtualbox" do |v| 
    v.cpus = 2 
    v.memory = 2048 
    end 

    # Provisioning 
    config.vm.provision "chef_solo" do |chef| 
    # chef.cookbooks_path = ['C:\vagrant'] 
    chef.add_recipe "example-webserver2012" 
    end 
end 

Berksfile

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

metadata 

cookbook 'iis' 

metadata.rb

name 'foobar' 
... 
depends 'iis' 

食譜/ default.rb

iis_site 'Default Web Site' do 
    action [:stop, :delete] 
end 

整個目錄結構是這樣的: 菜譜與berks cookbook example-webserver2012創建。 有2個vagrant文​​件,我正在使用頂層的文件。

$ tree vagrant-windows/ 
vagrant-windows/ 
├── Vagrantfile 
└── cookbooks 
    └── example-webserver2012 
     ├── Berksfile 
     ├── Berksfile.lock 
     ├── CHANGELOG.md 
     ├── Gemfile 
     ├── Gemfile.lock 
     ├── LICENSE 
     ├── README.md 
     ├── Thorfile 
     ├── Vagrantfile 
     ├── attributes 
     ├── chefignore 
     ├── files 
     │   └── default 
     ├── libraries 
     ├── metadata.rb 
     ├── providers 
     ├── recipes 
     │   └── default.rb 
     ├── resources 
     ├── templates 
     │   └── default 
     └── test 
      └── integration 

爲什麼cookbook'iis'找不到?

回答

0

未找到ISS食譜的原因是因爲你的包裝食譜example-webserver2012聲明依賴於Berkshelf的IIS食譜。不幸的是,與廚師獨奏供應商的流浪者不知道如何解決Berkshelf的依賴問題。你在這裏有幾個選項。

  • 使用berks vendor創建一個文件夾,其中包含所有已解決的食譜,並將Vagrantfile指向該文件夾。
  • 當您運行vagrant provision時,使用vagrant berkshelf插件執行berkshelf依賴關係解析。

從工作流程的預期來看,我發現vagrant berkshelf插件非常有用。

P.S.在您的Berksfile中,您不需要聲明對IIS Cookbook的依賴關係,因爲Berksfile中的metadata行會從metadata.rb中獲得依賴關係。

+0

你能告訴如何使用'vagrant berkshelf'插件來做berkshelf依賴解析嗎? – Starx 2016-07-06 10:30:06

+0

當流浪者開箱時,這不會自動發生嗎? – 2016-07-06 21:13:48

+0

它的確如此。但是,只有當您僅使用可從某個存儲庫中解決的那些食譜時,但是我正在使用本地食譜與開放源代碼的本地食譜混合使用,而該食譜則忽略了這一點。 – Starx 2016-07-21 08:48:09

相關問題