Chef-solo 找不到与 Vagrant 和 Windows 的食谱
Chef-solo can't find cookbook with Vagrant and Windows
我正在尝试与厨师 'iis' 食谱和 vagrant 一起管理 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.
流浪文件:
# -*- 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
伯克斯文件
source "https://supermarket.chef.io"
metadata
cookbook 'iis'
metadata.rb
name 'foobar'
...
depends 'iis'
recipes/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
为什么找不到食谱 'iis'?
找不到 ISS 说明书的原因是您的包装说明书 example-webserver2012
声明了对带有 Berkshelf 的 IIS 说明书的依赖性。不幸的是,带有 Chef solo provisioner 的 Vagrant 不知道如何开箱即用地解决 Berkshelf 依赖项。您在这里有几个选择。
- 使用
berks vendor
创建一个文件夹,其中包含所有已解析的食谱,并将 Vagrantfile 指向该文件夹。
- 当您 运行
vagrant provision
. 使用 vagrant berkshelf 插件进行 berkshelf 依赖解析
从工作流程的角度来看,我发现 vagrant berkshelf
插件非常有用。
P.S。在您的 Berksfile
中,您不需要声明对 IIS 说明书的依赖,由于 Berksfile 中的 metadata
行,该依赖将从 metadata.rb
中获取。
我正在尝试与厨师 'iis' 食谱和 vagrant 一起管理 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.
流浪文件:
# -*- 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
伯克斯文件
source "https://supermarket.chef.io"
metadata
cookbook 'iis'
metadata.rb
name 'foobar'
...
depends 'iis'
recipes/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
为什么找不到食谱 'iis'?
找不到 ISS 说明书的原因是您的包装说明书 example-webserver2012
声明了对带有 Berkshelf 的 IIS 说明书的依赖性。不幸的是,带有 Chef solo provisioner 的 Vagrant 不知道如何开箱即用地解决 Berkshelf 依赖项。您在这里有几个选择。
- 使用
berks vendor
创建一个文件夹,其中包含所有已解析的食谱,并将 Vagrantfile 指向该文件夹。 - 当您 运行
vagrant provision
. 使用 vagrant berkshelf 插件进行 berkshelf 依赖解析
从工作流程的角度来看,我发现 vagrant berkshelf
插件非常有用。
P.S。在您的 Berksfile
中,您不需要声明对 IIS 说明书的依赖,由于 Berksfile 中的 metadata
行,该依赖将从 metadata.rb
中获取。