# Chef Provisioning with Vagrant

**URL:** <https://discourse.chef.io/t/chef-provisioning-with-vagrant/5995>\
**Category:** Chef Infra (archive)\
**Created:** [November 27, 2014, 6:04pm UTC](https://discourse.chef.io/t/chef-provisioning-with-vagrant/5995 "2014-11-27T18:04:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pratik\_Gadiya](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@Pratik\_Gadiya](https://discourse.chef.io/u/Pratik_Gadiya)\
**Post date:** [November 27, 2014, 6:04pm UTC](https://discourse.chef.io/t/chef-provisioning-with-vagrant/5995/1 "2014-11-27T18:04:21Z")

</div>

Hi All,

I tried Chef-Provisioning with Vagrant by following steps listed on  
[https://github.com/opscode/chef-provisioning](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](http://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](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/](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:in`eval’  
from /root/.chef/vms/Vagrantfile:2:in `block 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:in `block in procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:in`block in  
capture\_configures’  
from internal:prelude:10:in `synchronize' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:in`capture\_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:in`block 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:in`set’  
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:in`call’  
from /usr/lib/ruby/vendor\_ruby/vagrant/environment.rb:392:in  
`load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:in`load!‘  
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](http://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 method`configure’ for Vagrant:Module (NoMethodError)  
from /root/.chef/vms/Vagrantfile:2:in `eval' from /root/.chef/vms/Vagrantfile:2:in`block 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:in`block  
in procs\_for\_source’  
from /usr/lib/ruby/vendor\_ruby/vagrant/config.rb:41:in `block in capture_configures' from <internal:prelude>:10:in`synchronize’  
from /usr/lib/ruby/vendor\_ruby/vagrant/config.rb:36:in  
`capture_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:in `block 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:in `set' 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:in `call' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in`load\_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

---

<div class="post-metadata">

**Author:** ![John\_Keiser1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/john_keiser1/32/202_2.png) [@John\_Keiser1](https://discourse.chef.io/u/John_Keiser1)\
**Post date:** [November 27, 2014, 7:13pm UTC](https://discourse.chef.io/t/chef-provisioning-with-vagrant/5995/2 "2014-11-27T19:13:49Z")

</div>

What revision of vagrant do you have?  
On Nov 27, 2014 10:04 AM, [pratik\_gadiya@persistent.co.in](mailto:pratik_gadiya@persistent.co.in) wrote:

> Hi All,
> 
> I tried Chef-Provisioning with Vagrant by following steps listed on  
> [GitHub - chef-boneyard/chef-provisioning: A library for creating machines and infrastructures idempotently in Chef.](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](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/](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:in `eval'  
> from /root/.chef/vms/Vagrantfile:2:in `block 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:in  
> `block in procs_for_source' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:41:in `block in  
> capture\_configures'  
> from internal:prelude:10:in `synchronize' from /usr/lib/ruby/vendor_ruby/vagrant/config.rb:36:in `capture\_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:in `block 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:in `set'  
> 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:in `call'  
> from /usr/lib/ruby/vendor\_ruby/vagrant/environment.rb:392:in  
> `load_config!' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:327:in `load!'  
> 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 method `configure' for Vagrant:Module (NoMethodError)  
> from /root/.chef/vms/Vagrantfile:2:in `eval' from /root/.chef/vms/Vagrantfile:2:in `block 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:in `block  
> in procs\_for\_source'  
> from /usr/lib/ruby/vendor\_ruby/vagrant/config.rb:41:in `block in capture_configures' from <internal:prelude>:10:in `synchronize'  
> from /usr/lib/ruby/vendor\_ruby/vagrant/config.rb:36:in  
> `capture_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:in  
> `block 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:in `set' 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:in `call' from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:392:in `load\_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
