[chef] Re: Chef-Provisioning (using vagrant)


Chronological Thread 
  • From: John Keiser < >
  • To:
  • Subject: [chef] Re: Chef-Provisioning (using vagrant)
  • Date: Tue, 2 Dec 2014 10:53:58 -0800

Weird.  Does this happen consistently?  What you might do is go to /root/.chef/vms and try to do a vagrant status or vagrant up from there ...

On Tue, Dec 2, 2014 at 3:39 AM, < " target="_blank"> > wrote:

Hi,

I am trying to provision VMs using Chef “machine” resource and Vagrant by
following steps described in links below
https://github.com/opscode/chef-provisioning
http://stackoverflow.com/questions/24655092/can-you-mix-chef-zero-chef-metal-chef-metal-vagrant-vagrant-and-berkshelf

Environment: Ubuntu 12.10 (This VM is behind a proxy)

Steps:
1.      Installed chef-server (11.1.0) and chef-client (11.8.2 ) on the VM.
Configured knife.
2.      Installed chef-provisioning and chef-provisioning-vagrant gems.
3.      Installed vagrant (Vagrant 1.6.4) and Virtualbox (4.1.12_Ubuntur77245)
4.      Added a vagrant box
:/opt# vagrant box list
precise64 (virtualbox, 0)
                (  Note : precise64 box was added by executing the command
“vagrant box add precise64 http://files.vagrantup.com/precise64.box” )
5.      Exported proxy settings
6.      Exported CHEF_DRIVER (export CHEF_DRIVER=vagrant)
7.      Created a cookbook ‘test’
8.      Contents of the default.rb file of the ‘test’ cookbook:

require 'chef/provisioning'
require 'chef/provisioning/vagrant_driver'

with_machine_options :vagrant_options => {
   'vm.box' => 'precise64'
}

machine 'PRKH23' do
tag 'itsa_me'
converge true
end

9.      Ran the recipe with the command:
chef-client -z -o test

10.     Complete Output Log:
:/opt/chef/chef-repo/cookbooks/test/recipes# chef-client -z -o test
[2014-12-02T14:59:41+05:30] INFO: Starting chef-zero on port 8889 with
repository at repository at /opt/chef/chef-repo
  One version per cookbook

[2014-12-02T14:59:41+05:30] INFO: Forking chef instance to converge...
Starting Chef Client, version 11.8.2
[2014-12-02T14:59:41+05:30] INFO: *** Chef 11.8.2 ***
[2014-12-02T14:59:41+05:30] INFO: Chef-client pid: 26262
[2014-12-02T14:59:43+05:30] WARN: Run List override has been provided.
[2014-12-02T14:59:43+05:30] WARN: Original Run List: []
[2014-12-02T14:59:43+05:30] WARN: Overridden Run List: [recipe[test]]
[2014-12-02T14:59:43+05:30] INFO: Run List is [recipe[test]]
[2014-12-02T14:59:43+05:30] INFO: Run List expands to [test]
[2014-12-02T14:59:43+05:30] INFO: Starting Chef Run for root
[2014-12-02T14:59:43+05:30] INFO: Running start handlers
[2014-12-02T14:59:43+05:30] INFO: Start handlers complete.
[2014-12-02T14:59:43+05:30] INFO: HTTP Request Returned 404 Not Found: Object
not found: /reports/nodes/root/runs
resolving cookbooks for run list: ["test"]
[2014-12-02T14:59:43+05:30] INFO: Loading cookbooks [test]
Synchronizing Cookbooks:
[2014-12-02T14:59:43+05:30] INFO: Storing updated
cookbooks/test/recipes/default.rb in the cache.
  - test
Compiling Cookbooks...
Converging 1 resources
Recipe: test::default
  * machine[PRKH23] action converge[2014-12-02T14:59:44+05:30] INFO: Processing
machine[PRKH23] action converge (test::default line 34)
[2014-12-02T14:59:44+05:30] INFO: HTTP Request Returned 404 Not Found: Object
not found: http://127.0.0.1:8889/nodes/PRKH23
[2014-12-02T14:59:44+05:30] INFO: Processing vagrant_cluster[/root/.chef/vms]
action create (basic_chef_client::block line 212)
[2014-12-02T14:59:44+05:30] INFO: Processing directory[/root/.chef/vms] action
create (basic_chef_client::block line 15)
[2014-12-02T14:59:44+05:30] INFO: Processing file[/root/.chef/vms/Vagrantfile]
action create (basic_chef_client::block line 16)
[2014-12-02T14:59:44+05:30] INFO: Processing file[/root/.chef/vms/PRKH23.vm]
act                                             )
[2014-12-02T14:59:44+05:30] INFO: file[/root/.chef/vms/PRKH23.vm] created file
/

    - create new file /root/.chef/vms/PRKH23.vm[2014-12-02T14:59:44+05:30]
INFO:                                              contents
/root/.chef/vms/PRKH23.vm

    - update content in file /root/.chef/vms/PRKH23.vm from none to a66a10
    - --- /root/.chef/vms/PRKH23.vm     2014-12-02 14:59:44.096619074 +0530
    - +++ /tmp/.PRKH23.vm20141202-26262-f6i005  2014-12-02 14:59:44.096619074
+0
    - @@ -1 +1,7 @@
    - +Vagrant.configure('2') do |outer_config|
    - +  outer_config.vm.define "PRKH23" do |config|
    - +    config.vm.box = "precise64"
    - +    config.vm.hostname = "PRKH23"
    - +  end
    - +end[2014-12-02T14:59:44+05:30] INFO: Processing chef_node[PRKH23] action
[2014-12-02T14:59:44+05:30] INFO: HTTP Request Returned 404 Not Found: Object
no

    - create node PRKH23 at http://127.0.0.1:8889
    -   add normal.tags = ["itsa_me"]
    -   add normal.chef_provisioning =
{"location"=>{"driver_url"=>"vagrant:/roo
      name"=>"PRKH23", "vm_file_path"=>"/root/.chef/vms/PRKH23.vm",
"allocated_at"=>"2
/127.0.0.1:8889/nodes/", "needs_reload"=>true}}
================================================================================
Error executing action `converge` on resource 'machine[PRKH23]'
================================================================================


RuntimeError
------------
vagrant up PRKH23 failed!
STDOUT:Bringing machine 'PRKH23' up with 'virtualbox' provider...
==> PRKH23: Importing base box 'precise64'...
==> PRKH23: Matching MAC address for NAT networking...
==> PRKH23: Setting the name of the VM: vms_PRKH23_1417512603559_27719
==> PRKH23: Clearing any previously set network interfaces...
==> PRKH23: Preparing network interfaces based on configuration...
    PRKH23: Adapter 1: nat
==> PRKH23: Forwarding ports...
    PRKH23: 22 => 2222 (adapter 1)
==> PRKH23: Booting VM...
==> PRKH23: Waiting for machine to boot. This may take a few minutes...

STDERR:The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.



Resource Declaration:
---------------------
# In /root/.chef/local-mode-cache/cache/cookbooks/test/recipes/default.rb

34: machine 'PRKH23' do
35: tag 'itsa_me'
36: converge true
37: end
38:



Compiled Resource:
------------------
# Declared in
/root/.chef/local-mode-cache/cache/cookbooks/test/recipes/default.rb:34:in
`from_file'

machine("PRKH23") do
  action :converge
  retries 0
  retry_delay 2
  chef_server {:chef_server_url=>"http://127.0.0.1:8889",
:options=>{:client_name=>"root",
:signing_key_filename=>"/root/.chef/root.pem"}}
  driver "vagrant"
  machine_options {:vagrant_options=>{"vm.box"=>"precise64"}}
  cookbook_name "test"
  recipe_name "default"
  attribute_modifiers [["tags",
#<Proc:0x0000000270f2e0@/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/cheffish-0.9/lib/cheffish.rb:149>]]
  converge true
end



[2014-12-02T15:00:13+05:30] INFO: Running queued delayed notifications before
re-raising exception
[2014-12-02T15:00:13+05:30] ERROR: Running exception handlers
[2014-12-02T15:00:13+05:30] ERROR: Exception handlers complete
[2014-12-02T15:00:13+05:30] FATAL: Stacktrace dumped to
/root/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated
[2014-12-02T15:00:13+05:30] ERROR: machine[PRKH23] (test::default line 34) had
an error: RuntimeError: vagrant up PRKH23 failed!
STDOUT:Bringing machine 'PRKH23' up with 'virtualbox' provider...
==> PRKH23: Importing base box 'precise64'...
==> PRKH23: Matching MAC address for NAT networking...
==> PRKH23: Setting the name of the VM: vms_PRKH23_1417512603559_27719
==> PRKH23: Clearing any previously set network interfaces...
==> PRKH23: Preparing network interfaces based on configuration...
    PRKH23: Adapter 1: nat
==> PRKH23: Forwarding ports...
    PRKH23: 22 => 2222 (adapter 1)
==> PRKH23: Booting VM...
==> PRKH23: Waiting for machine to boot. This may take a few minutes...

STDERR:The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

[2014-12-02T15:00:13+05:30] FATAL: Chef::Exceptions::ChildConvergeError: Chef
run process exited unsuccessfully (exit code 1)

Any pointers on how to resolve this will be appreciated.

Thanks,
Preeti




Archive powered by MHonArc 2.6.16.

§