I am using chef to create a basic vm in vcenter. Its able to create the vm uisng chef proviosning driver, But the chef-client is throwing errors.
Recipe:
------------------------------------------------------------------------------------------------------------------------
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end
require 'chef/provisioning/vsphere_driver'
with_vsphere_driver host: 'vcenterhostname',
insecure: true,
user: 'username',
password: 'password'
with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 2,
memory_mb: 4096,
network_name: ["VM Network"],
datacenter: 'Sandbox',
datastore: 'Datastore_Esx2',
resource_pool: 'Box-Cluster',
template_name: 'TemplateName',
template_folder: 'Templates/',
customization_spec: {
ipsettings: {
dnsServerList: ['ipaddress']
},
:domain => 'domainname'
},
:ssh => {
:user => 'root',
:password => 'password',
:paranoid => false,
}
}
machine "Centos" do
run_list ['vmware::machines']
end
Executing chef-client -l info on root@ipadddress
[Centos] [2015-08-04T11:21:54-04:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.4.1 [0m
[2015-08-04T11:21:54-04:00] INFO: *** Chef 12.4.1 ***
[2015-08-04T11:21:54-04:00] INFO: Chef-client pid: 9394
[2015-08-04T11:21:57-04:00] INFO: Run List is [recipe[vmware::machines]]
[2015-08-04T11:21:57-04:00] INFO: Run List expands to [vmware::machines]
[2015-08-04T11:21:57-04:00] INFO: Starting Chef Run for Centos
[2015-08-04T11:21:57-04:00] INFO: Running start handlers
[2015-08-04T11:21:57-04:00] INFO: Start handlers complete.
[2015-08-04T11:21:57-04:00] INFO: HTTP Request Returned 404 Not Found : Object not found: /reports/nodes/Centos/runs
resolving cookbooks for run list: ["vmware::machines"] [0m
[2015-08-04T11:22:02-04:00] INFO: Loading cookbooks [vmw...@1.28.0, xyz-base...@0.0.2, chef-...@2.5.0]
Synchronizing Cookbooks: [0m
- vmware [0m
- xyz-base-cookbook [0m
- chef-sugar [0m
Compiling Cookbooks... [0m
[0m
================================================================================ [0m
[31mRecipe Compile Error [0m
================================================================================ [0m
[0mChef::Exceptions::RecipeNotFound [0m
-------------------------------- [0m
could not find recipe machines for cookbook vmware [0m
[0m [0m
Running handlers: [0m
[2015-08-04T11:22:03-04:00] ERROR: Running exception handlers
Running handlers complete
[0m[2015-08-04T11:22:03-04:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 8.948866571 seconds [0m
[2015-08-04T11:22:03-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-08-04T11:22:03-04:00] ERROR: could not find recipe machines for cookbook vmware
[2015-08-04T11:22:03-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[2015-08-04T10:22:03-05:00] INFO: Completed chef-client -l info on root@ipaddress: exit status 1
================================================================================
Error executing action `converge` on resource 'machine[Centos]'
================================================================================
RuntimeError
------------
Error: command 'chef-client -l info' exited with code 1.
Resource Declaration:
---------------------
# In C:/Users/xyz/.chef/local-mode-cache/cache/cookbooks/vmware-machines/recipes/machines.rb
36: machine "Centos" do
37: #run_list ['vmware::machines']
38: end
Compiled Resource:
------------------
# Declared in C:/Users/xyz/.chef/local-mode-cache/cache/cookbooks/vmware-machines/recipes/machines.rb:36:in `from_file'
machine("Centos") do
action :converge
retries 0
retry_delay 2
default_guard_interpreter :default
chef_server {:chef_server_url=>"chefzero://localhost:8889", :options=>{:client_name=>"chef-local", :signing_key_filename=>"C:\\eclipse\\xyz\\workspace\\xyz\\vmware\\target\\.chef\\dummy.pem"}}
machine_options {:bootstrap_options=>{:use_linked_clone=>true, :num_cpus=>2, :memory_mb=>4096, :network_name=>["VM Network"], :datacenter=>"Sandbox", :datastore=>"Datastore_Esx2", :resource_pool=>"Box-Cluster", :template_name=>"Template", :template_folder=>"Templates/", :customization_spec=>{:ipsettings=>{:dnsServerList=>["xyz"]}, :domain=>"xyz"}, :ssh=>{:user=>"root", :password=>"password", :paranoid=>false}}}
declared_type :machine
cookbook_name "vmware-machines"
recipe_name "machines"
end
[2015-08-04T10:22:03-05:00] INFO: Running queued delayed notifications before re-raising exception
-------------------------------------------------------------------------------------------------------------------------------------------------------------