2014-12-29 4 views
0

Я пытаюсь создать простую виртуальную машину разработки с использованием бродяг и шеф-поваров в качестве средства обеспечения. Я могу установить шеф-повар с помощью средства обеспечения оболочки, но мне кажется, что папка с рецептами шеф-повара не устанавливается на виртуальную машину. Он продолжает жаловаться, что поваренная книга *** не найдена. Вот мой бродяга файл и вывод я получаюVagrant & Chef - Cookbook *** не найден

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

Vagrant::Config.run do |config| 
    # This strange method defines the name of the Vagrant Machine 
    config.vm.define "SubscriptionAPI" do |foobar| 
    end 

    # Every Vagrant virtual environment requires a box to build off of. 
    config.vm.box = "chef/centos-6.5" 

    # The url from where the 'config.vm.box' box will be fetched if it 
    # doesn't already exist on the user's system. 
    # config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box" 

    # Boot with a GUI so you can see the screen. (Default is headless) 
    # config.vm.boot_mode = :gui 

    # Assign this VM to a host-only network IP, allowing you to access it 
    # via the IP. Host-only networks can talk to the host machine as well as 
    # any other machines on the same network, but cannot be accessed (through this 
    # network interface) by any external networks. 
    config.vm.network :hostonly, "192.168.99.101" 

    # Assign this VM to a bridged network, allowing you to connect directly to a 
    # network using the host's network device. This makes the VM appear as another 
    # physical device on your network. 
    # config.vm.network :bridged 

    # Forward a port from the guest to the host, which allows for outside 
    # computers to access the VM, whereas host only networking does not. 
    config.vm.forward_port 80, 8080 
    config.vm.forward_port 443, 44343 

    # Share an additional folder to the guest VM. The first argument is 
    # an identifier, the second is the path on the guest to mount the 
    # folder, and the third is the path on the host to the actual folder. 
    # config.vm.share_folder "www", "/www", "../www" 

    # Make sure the chef is intalled to the VM 
    config.vm.provision "shell", path: "provisioning/utils/tools/install_chef.bash" 

    # Enable provisioning with chef solo, specifying a cookbooks path, roles 
    # path, and data_bags path (all relative to this Vagrantfile), and adding 
    # some recipes and/or roles. 
    # 
    config.vm.provision :chef_solo do |chef| 
    chef.roles_path = "provisioning/chef/roles" 
    chef.cookbooks_path = "provisioning/chef/cookbooks" 
    chef.add_role "vagrant-test-box" 

    # chef.cookbooks_path = "provisioning/chef/cookbooks" 
    # chef.add_recipe "httpd" 
    # chef.roles_path = "chef/roles" 
    # chef.data_bags_path = "chef/databags" 
    # chef.add_role "devbox" 
    # 
    # # You may also specify custom JSON attributes: 
    # chef.json = { :mysql_password => "foo" } 
    end 

    config.vm.host_name = "subscriptionapi" 

end 

Выход

==> SubscriptionAPI: Thank you for installing Chef! 
==> SubscriptionAPI: Running provisioner: chef_solo... 
Generating chef JSON and uploading... 
==> SubscriptionAPI: Running chef-solo... 
==> SubscriptionAPI: [2014-12-24T12:20:04+00:00] INFO: Forking chef instance to converge... 
==> SubscriptionAPI: [2014-12-24T12:20:04+00:00] INFO: *** Chef 12.0.3 *** 
==> SubscriptionAPI: [2014-12-24T12:20:04+00:00] INFO: Chef-client pid: 3442 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Setting the run_list to ["role[vagrant-test-box]"] from CLI options 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Run List is [role[vagrant-test-box]] 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Run List expands to [httpd] 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Starting Chef Run for subscriptionapi 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Running start handlers 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] INFO: Start handlers complete. 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] ERROR: Running exception handlers 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] ERROR: Exception handlers complete 
==> SubscriptionAPI: [2014-12-24T12:20:08+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
==> SubscriptionAPI: [2014-12-24T12:20:09+00:00] ERROR: Cookbook httpd not found. If you're loading httpd from another cookbook, make sure you configure the dependency in your metadata 
==> SubscriptionAPI: [2014-12-24T12:20:09+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 
Chef never successfully completed! Any errors should be visible in the 
output above. Please fix your recipes so that they properly complete. 

снабжение/повар/роли/бродяга-тест-box.rb

# Name of the role should match the name of the file 
name "vagrant-test-box" 

# Run list function we mentioned earlier 
run_list(
    "recipe[httpd]" 
) 

снабжение/повар/поваренные книги/httpd/recipes/default.rb

package("httpd") 

Это было навсегда, я пытаюсь решить проблему, выкапывая Интернет и проверяя разные виды разрешений снова и снова - и все равно не повезло

+0

Можете ли вы обеспечить, чтобы поваренные книги загружались в коробку через бродячие ssh и 'ls/tmp/vagrant */provisoning /'? Я не использую шеф-повара, но похоже, что бродяга не копировал кулинарные книги. Если это так, вам, возможно, придется использовать общую папку (и, по словам бродячего документа, это звучит как ошибка) – Tensibai

+0

У меня есть следующее:/tmp/vagrant-chef-3/chef-solo-1/recipes (empty) ,/tmp/vagrant-chef-3/chef-solo-2/role (с копиями ролей), /tmp/vagrant-chef-3/dna.json (содержит список воспроизведения) и/tmp/vagrant-chef-3 /solo.rb с настройками некоторых каталогов. cookbook_path ["/ tmp/vagrant-chef-3/chef-solo-1/cookbooks"] - и он пуст –

ответ

1

Я нашел проблему. Это был брандмауэр-баркшельф, вызывающий проблему. Деинсталлирование сделало все безупречным работу

+1

Вы можете либо сделать это, либо включить эти кулинарные книги в Berksfile. – jkulak

Смежные вопросы