Chef Provisioning with Vagrant


#1

Hi All,

I tried Chef-Provisioning with Vagrant by following steps listed on
https://github.com/opscode/chef-provisioning but facing issues as follows:

ERROR:

chef-client -z simple.rb

[2014-11-27T17:22:56+05:30] WARN: No config file found or specified on command
line, using command line options.
[2014-11-27T17:22:56+05:30] WARN: No cookbooks directory found at or above
current directory. Assuming /opt/data/chef-machine-resource.
Starting Chef Client, version 11.16.4
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Compiling Cookbooks…
[2014-11-27T17:22:59+05:30] WARN: Node hadoop4.persistent.co.in has an empty
run list.
Converging 1 resources
Recipe: @recipe_files::/opt/data/chef-machine-resource/simple.rb

  • machine[mario1] action converge
    • create new file /root/.chef/vms/mario1.vm
    • update content in file /root/.chef/vms/mario1.vm from none to 8776f3
    • — /root/.chef/vms/mario1.vm 2014-11-27 17:22:59.934957709 +0530
    • +++ /tmp/.mario1.vm20141127-28880-1tvmotp 2014-11-27 17:22:59.934957709
      +0530
    • @@ -1 +1,6 @@
    • +Vagrant.configure(‘2’) do |outer_config|
      • outer_config.vm.define “mario1” do |config|
      • config.vm.hostname = “mario1”
      • end
    • +end
    • create node mario1 at http://localhost:8889
    • add normal.tags = [“itsa_me”]
    • add normal.chef_provisioning =
      {“location”=>{“driver_url”=>“vagrant:/root/.chef/vms”,
      “driver_version”=>“0.8.1”, “vm_name”=>“mario1”,
      “vm_file_path”=>"/root/.chef/vms/mario1.vm", “allocated_at”=>“2014-11-27
      11:52:59 UTC”, “host_node”=>“http://localhost:8889/nodes/”,
      “needs_reload”=>true}}

================================================================================
Error executing action converge on resource ‘machine[mario1]’

================================================================================

RuntimeError
------------
vagrant up mario1 failed!
STDOUT:
STDERR:/root/.chef/vms/mario.vm:1:in `block in <top (required)>': undefined

method configure' for Vagrant:Module (NoMethodError) from /root/.chef/vms/Vagrantfile:2:ineval’
from /root/.chef/vms/Vagrantfile:2:in block in <top (required)>' from /root/.chef/vms/Vagrantfile:1:inglob’
from /root/.chef/vms/Vagrantfile:1:in <top (required)>' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:inload’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:in block in procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:inblock in
capture_configures’
from internal:prelude:10:in synchronize' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:incapture_configures’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:114:in
procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:51:inblock in
set’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:in each' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:inset’
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:377:in block in load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:incall’
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in
load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:inload!‘
from /usr/bin/vagrant:40:in `’

Resource Declaration:
---------------------
# In /opt/data/chef-machine-resource/simple.rb

  2: machine 'mario1' do
  3: tag 'itsa_me'
  4: #converge true
  5: end

Compiled Resource:
------------------
# Declared in /opt/data/chef-machine-resource/simple.rb:2:in `from_file'

machine("mario1") do
  action :converge
  retries 0
  retry_delay 2
  guard_interpreter :default
  chef_server {:chef_server_url=>"http://localhost:8889",

:options=>{:client_name=>“hadoop4.persistent.co.in”,
:signing_key_filename=>nil}}
driver "vagrant"
cookbook_name "@recipe_files"
recipe_name "/opt/data/chef-machine-resource/simple.rb"
attribute_modifiers [[“tags”,
#Proc:0x00000003c451f0@/var/lib/gems/1.9.1/gems/cheffish-0.9/lib/cheffish.rb:149]]
end

Running handlers:
[2014-11-27T17:23:00+05:30] ERROR: Running exception handlers
Running handlers complete
[2014-11-27T17:23:00+05:30] ERROR: Exception handlers complete
[2014-11-27T17:23:00+05:30] FATAL: Stacktrace dumped to
/root/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 3.868495522 seconds
[2014-11-27T17:23:00+05:30] ERROR: machine[mario1]
(@recipe_files::/opt/data/chef-machine-resource/simple.rb line 2) had an error:
RuntimeError: vagrant up mario1 failed!
STDOUT:
STDERR:/root/.chef/vms/mario.vm:1:in block in <top (required)>': undefined methodconfigure’ for Vagrant:Module (NoMethodError)
from /root/.chef/vms/Vagrantfile:2:in eval' from /root/.chef/vms/Vagrantfile:2:inblock in <top (required)>'
from /root/.chef/vms/Vagrantfile:1:in glob' from /root/.chef/vms/Vagrantfile:1:in<top (required)>'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:in load' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:inblock
in procs_for_source’
from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:in block in capture_configures' from <internal:prelude>:10:insynchronize’
from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:in
capture_configures' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:114:inprocs_for_source’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:51:in block in set' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:ineach’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:in set' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:377:inblock in
load_config!'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in call' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:inload_config!'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:in load!' from /usr/bin/vagrant:40:in

[2014-11-27T17:23:00+05:30] FATAL: Chef::Exceptions::ChildConvergeError: Chef
run process exited unsuccessfully (exit code 1)

I am trying this on Ubuntu machine and here is my simple.rb

$ cat simple.rb
require 'chef/provisioning’
machine ‘mario1’ do
tag 'itsa_me’
converge true
end

Installed :

  1. chef-provisioning, chef-provisioning-vagrant gems installed
  2. virtual box
  3. vagrant

Please let me know how can I resolve the same

Thanks,
Pratik


#2

What revision of vagrant do you have?
On Nov 27, 2014 10:04 AM, pratik_gadiya@persistent.co.in wrote:

Hi All,

I tried Chef-Provisioning with Vagrant by following steps listed on
https://github.com/opscode/chef-provisioning but facing issues as follows:

ERROR:

chef-client -z simple.rb

[2014-11-27T17:22:56+05:30] WARN: No config file found or specified on
command
line, using command line options.
[2014-11-27T17:22:56+05:30] WARN: No cookbooks directory found at or above
current directory. Assuming /opt/data/chef-machine-resource.
Starting Chef Client, version 11.16.4
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Compiling Cookbooks…
[2014-11-27T17:22:59+05:30] WARN: Node hadoop4.persistent.co.in has an
empty
run list.
Converging 1 resources
Recipe: @recipe_files::/opt/data/chef-machine-resource/simple.rb

  • machine[mario1] action converge
    • create new file /root/.chef/vms/mario1.vm
    • update content in file /root/.chef/vms/mario1.vm from none to 8776f3
    • — /root/.chef/vms/mario1.vm 2014-11-27 17:22:59.934957709 +0530
    • +++ /tmp/.mario1.vm20141127-28880-1tvmotp 2014-11-27
      17:22:59.934957709
      +0530
    • @@ -1 +1,6 @@
    • +Vagrant.configure(‘2’) do |outer_config|
      • outer_config.vm.define “mario1” do |config|
      • config.vm.hostname = “mario1”
      • end
    • +end
    • create node mario1 at http://localhost:8889
    • add normal.tags = [“itsa_me”]
    • add normal.chef_provisioning =
      {“location”=>{“driver_url”=>“vagrant:/root/.chef/vms”,
      “driver_version”=>“0.8.1”, “vm_name”=>“mario1”,
      “vm_file_path”=>"/root/.chef/vms/mario1.vm", “allocated_at”=>“2014-11-27
      11:52:59 UTC”, “host_node”=>“http://localhost:8889/nodes/”,
      “needs_reload”=>true}}

================================================================================
Error executing action converge on resource ‘machine[mario1]’

================================================================================

RuntimeError
------------
vagrant up mario1 failed!
STDOUT:
STDERR:/root/.chef/vms/mario.vm:1:in `block in <top (required)>':

undefined
method configure' for Vagrant:Module (NoMethodError) from /root/.chef/vms/Vagrantfile:2:ineval’
from /root/.chef/vms/Vagrantfile:2:in block in <top (required)>' from /root/.chef/vms/Vagrantfile:1:inglob’
from /root/.chef/vms/Vagrantfile:1:in <top (required)>' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:inload’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:in
block in procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:inblock in
capture_configures’
from internal:prelude:10:in synchronize' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:incapture_configures’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:114:in
procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:51:inblock in
set’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:in
each' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:inset’
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:377:in
block in load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:incall’
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in
load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:inload!‘
from /usr/bin/vagrant:40:in `’

Resource Declaration:
---------------------
# In /opt/data/chef-machine-resource/simple.rb

  2: machine 'mario1' do
  3: tag 'itsa_me'
  4: #converge true
  5: end

Compiled Resource:
------------------
# Declared in /opt/data/chef-machine-resource/simple.rb:2:in

`from_file’

machine("mario1") do
  action :converge
  retries 0
  retry_delay 2
  guard_interpreter :default
  chef_server {:chef_server_url=>"http://localhost:8889",

:options=>{:client_name=>“hadoop4.persistent.co.in”,
:signing_key_filename=>nil}}
driver "vagrant"
cookbook_name "@recipe_files"
recipe_name "/opt/data/chef-machine-resource/simple.rb"
attribute_modifiers [[“tags”,
#<Proc:0x00000003c451f0@
/var/lib/gems/1.9.1/gems/cheffish-0.9/lib/cheffish.rb:149>]]
end

Running handlers:
[2014-11-27T17:23:00+05:30] ERROR: Running exception handlers
Running handlers complete
[2014-11-27T17:23:00+05:30] ERROR: Exception handlers complete
[2014-11-27T17:23:00+05:30] FATAL: Stacktrace dumped to
/root/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 3.868495522 seconds
[2014-11-27T17:23:00+05:30] ERROR: machine[mario1]
(@recipe_files::/opt/data/chef-machine-resource/simple.rb line 2) had an
error:
RuntimeError: vagrant up mario1 failed!
STDOUT:
STDERR:/root/.chef/vms/mario.vm:1:in block in <top (required)>': undefined methodconfigure’ for Vagrant:Module (NoMethodError)
from /root/.chef/vms/Vagrantfile:2:in eval' from /root/.chef/vms/Vagrantfile:2:inblock in <top (required)>'
from /root/.chef/vms/Vagrantfile:1:in glob' from /root/.chef/vms/Vagrantfile:1:in<top (required)>'
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:in
load' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:115:inblock
in procs_for_source’
from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:in block in capture_configures' from <internal:prelude>:10:insynchronize’
from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:in
capture_configures' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:114:inprocs_for_source’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:51:in
block in set' from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:ineach’
from /usr/lib/ruby/vendor_ruby/vagrant/config/loader.rb:45:in set' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:377:inblock in
load_config!'
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in call' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:inload_config!‘
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:in
load!' from /usr/bin/vagrant:40:in

[2014-11-27T17:23:00+05:30] FATAL: Chef::Exceptions::ChildConvergeError:
Chef
run process exited unsuccessfully (exit code 1)

I am trying this on Ubuntu machine and here is my simple.rb

$ cat simple.rb
require 'chef/provisioning’
machine ‘mario1’ do
tag 'itsa_me’
converge true
end

Installed :

  1. chef-provisioning, chef-provisioning-vagrant gems installed
  2. virtual box
  3. vagrant

Please let me know how can I resolve the same

Thanks,
Pratik