Open ktlim86 opened 8 years ago
looks like it is trying to connect to the windows node using an IPv6 ip that it can't reach. This can happen for a number of reasons. Often because of misconfigured network settings. Start by checking to see if the provisioned node has a valid and reachable IP address.
Hi mwrock,
I manage to disable the ipv6 through Windows registry and convert into a VM template. This works. However, I met with another problem.
here is the error message from chef-stacktrace.out
Generated at 2016-03-30 15:17:59 +0800
Errno::ENETUNREACH: machine[server04] (setup_vm::default line 53) had an error: Errno::ENETUNREACH: A socket operation was attempted to an unreachable network. - connect(2) for "169.254.77.55" port 5985 (169.254.77.55:5985)
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `initialize'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `new'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `create_socket'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:742:in `block in connect'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:101:in `call'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:735:in `connect'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:497:in `query'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:170:in `query'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:1238:in `do_get_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:1021:in `block in do_request'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:1129:in `protect_keep_alive_disconnected'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:1016:in `do_request'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:858:in `request'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.7.1/lib/httpclient.rb:761:in `post'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/http/transport.rb:47:in `send_request'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/winrm_service.rb:498:in `send_message'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/winrm_service.rb:399:in `run_wql'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/command_executor.rb:171:in `os_version'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/command_executor.rb:130:in `code_page'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/command_executor.rb:72:in `block in open'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/command_executor.rb:203:in `retryable'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/command_executor.rb:71:in `open'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/winrm_service.rb:365:in `create_executor'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/winrm-1.7.0/lib/winrm/winrm_service.rb:351:in `run_powershell_script'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/winrm.rb:43:in `block in execute'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:35:in `block in catch'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/timeout.rb:106:in `timeout'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport.rb:92:in `with_execute_timeout'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/winrm.rb:37:in `execute'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/windows_machine.rb:79:in `system_drive'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:23:in `setup_convergence'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:17:in `setup_convergence'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provider/machine.rb:58:in `block in <class:Machine>'
(eval):2:in `block in action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `instance_eval'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `compile_and_converge_action'
(eval):2:in `action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:73:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:104:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:668:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:702:in `converge_and_save'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:280:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:433:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `loop'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:412:in `run_application'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `load'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `<main>'
Here is my default.rb used to provision the VM.
#
# Cookbook Name:: setup_vm
# Recipe:: default
#
# Copyright 2016, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
# Reference: https://github.com/CenturyLinkCloud/chef-provisioning-vsphere#kitchen-driver
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end
require 'chef/provisioning/vsphere_driver'
with_vsphere_driver host: 'VCENTER_HOST_IP',
insecure: true,
user: 'VCENTER_USER',
password: 'VCENTRE_PASSWORD'
with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 4,
host: 'ESX_HOST_IP',
memory_mb: 4096,
network_name: ["MY_INTERNET_FOLDER"],
datastore: "MY_DATASTORE",
additional_disk_size_gb: [100],
datacenter: 'MY_DATASTORE',
template_name: 'WINDOWS_TEMPLATE',
customization_spec: {
ip: 'NEW_VM_IP',
subnetMask: 'NEW_VM_NETMASK',
gateway: 'NEW_VM_GATEWAY',
ipsettings: {
dnsServerList: ['DNS1','DNS2']
},
win_time_zone: 215,
domain: 'local',
org_name: 'my_org',
product_id: '',
hostname: 'server04'
},
:ssh => {
:user => 'administrator',
:password => 'NEW_VM_PASSWORD',
:paranoid => false,
}
}
machine "server04" do
run_list ['setup_vm::default']
end
I realize that the IPv4 has not been configured but the DNS IP has been configured. How do I resolve this? Thanks
Hi mwrock,
Just to note that the IP address is private.
The machine from where you are running the provisioning must be able to reach the provisioned node in order to bootstrap it with the chef client.
Hi mwrock,
Thanks for the quick reply. Just want to ask you, do I need to set any IP address on the VM template before bootstrapping? This is one thing that I dont understand. Because I have specified the IP to be set on the new VM created from the VM templare and I thought chef-provisioner will do that. Thanks.
shouldn't have to set an ip in the template. That would defeat the purpose of the template :). VMWare should set the ip appropriately based on the provisioning config. However sometimes that can break because:
I suggest cloning the VM directly from the vsphere client first, assigning all the settings you intend to set in the chef provisioner. Then see if the vm is assigned the ip you expect and you can reach that machine on that IP. If things don't work in the vsphere client, you want to troubleshoot outside of chef just to make it less confusing where things might be going wrong.
Hi mwrock,
Thanks for the quick reply! I managed to narrow down to the portion where I need a DHCP server to assign the IP address and it will work well. However, I have encountered another problem.
Below is the chef-stacktrace.out
.
Generated at 2016-03-31 17:51:04 +0800
RuntimeError: machine[server05] (setup_vm::default line 53) had an error: RuntimeError: Error: command 'chef-client -l info' exited with code 1.
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/winrm.rb:148:in `error!'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:31:in `block in execute'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `add_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:175:in `converge_by'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:54:in `perform_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:29:in `execute'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:59:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:56:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:55:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:21:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provider/machine.rb:67:in `block in <class:Machine>'
(eval):2:in `block in action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `instance_eval'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `compile_and_converge_action'
(eval):2:in `action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:73:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:104:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:668:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:702:in `converge_and_save'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:280:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:433:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `loop'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:412:in `run_application'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `load'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `<main>'
I saw on the console that it have this message.
[2016-03-31T18:16:58+08:00] ERROR: SSL Validation failure connecting to host: MY_HOSTNAME - SSL_connect returned=1 errno=0 state=error: certificate verify failed
================================================================================
Chef encountered an error attempting to load the node data for "server05"
================================================================================
Unexpected Error:
-----------------
OpenSSL::SSL::SSLError: SSL Error connecting to https://MY_HOSTNAME/organizations/MY_HOSTNAME/nodes/server05 - SSL_connect returned=1 errno=0 state=error: certificate verify failed
[2016-03-31T18:16:58+08:00] ERROR: Running exception handlers
[2016-03-31T18:16:58+08:00] ERROR: Exception handlers complete
[2016-03-31T18:16:58+08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2016-03-31T18:16:58+08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-03-31T18:16:58+08:00] FATAL: OpenSSL::SSL::SSLError: SSL Error connecting to https://MY_HOSTNAME/organizations/MY_HOSTNAME/nodes/server05 - SSL_connect returned=1 errno=0 state=error: certificate verify failed
In this case, I am setting up my own chef server and I want to ask if there is a way to bypass the certificate verify. Thanks.
You can get around this error by specifying :verify_none
for the :ssl_verify_mode
convergence option.
See the chef-provisioning readme for a list of convergence options.
Hi mwrock,
Thanks for the quick reply! I have tried what you have suggested but still I cant bypass the certificate error.
Here is my default.rb
.
require 'chef/provisioning'
require 'chef/provisioning/vsphere_driver'
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end
with_vsphere_driver host: 'VCENTER_IP',
insecure: true,
user: 'VCENTER_USER',
password: 'VCENTER_PASSWORD'
with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 4,
host: 'ESXI_HOST_IP',
memory_mb: 4096,
network_name: ["NETWORK_FOLDER"],
datastore: "DATASTORE",
#additional_disk_size_gb: [100],
datacenter: 'DATACENTER',
template_name: 'BASE_WINDOWS',
convergence_options: {
ssl_verify_mode: :verify_none # This is not working
},
customization_spec: {
ip: 'NEW_VM_IP',
subnetMask: 'NEW_VM_SUBNET',
gateway: 'NEW_VM_GATEWAY',
ipsettings: {
dnsServerList: ['NEW_VM_DNS','NEW_VM_DNS']
},
win_time_zone: 215,
domain: 'local',
org_name: 'my_org',
product_id: '',
hostname: 'server09'
},
:ssh => {
:user => 'NEW_VM_USER',
:password => 'NEW_VM_PASSWORD',
:paranoid => false,
}
}
machine "server09" do
run_list ['setup_vm::default']
end
I do a manual check on the NEW_VM machine and saw that the chef was successfully installed.
However, an error is generated when I issue chef-client -l info
in the powershell and it returned
OpenSSL::SSL::SSLError: SSL Error connecting to https://MY_HOSTNAME/organizations/MY_ORG/nodes/server09 - SSL_connect returned=1 errno=0 state=error: certificate verify failed
I also did a check on the client.rb
located in the C:\chef
and found that the ssl_verify_mode
is not set to :verify_none
. Below is my client.rb
chef_server_url "https://HOSTNAME/organizations/MY_ORG"
node_name "server09"
client_key "C:\\chef\\client.pem"
ssl_verify_mode :verify_peer
After I do a manual set to :verify_none
, and run the chef-client -l info
, this is the output I received.
Starting Chef Client, version 12.8.1
[2016-04-04T17:39:43+08:00] INFO: *** Chef 12.8.1 ***
[2016-04-04T17:39:43+08:00] INFO: Chef-client pid: 2160
[2016-04-04T17:39:47+08:00] INFO: Run List is [recipe[setup_vm::default]]
[2016-04-04T17:39:47+08:00] INFO: Run List expands to [setup_vm::default]
[2016-04-04T17:39:47+08:00] INFO: Starting Chef Run for server09
[2016-04-04T17:39:47+08:00] INFO: Running start handlers
[2016-04-04T17:39:47+08:00] INFO: Start handlers complete.
resolving cookbooks for run list: ["setup_vm::default"]
[2016-04-04T17:39:48+08:00] INFO: Loading cookbooks [setup_vm@0.1.0]
Synchronizing Cookbooks:
[2016-04-04T17:39:48+08:00] INFO: Storing updated cookbooks/setup_vm/recipes/default.rb in the cache.
[2016-04-04T17:39:48+08:00] INFO: Storing updated cookbooks/setup_vm/CHANGELOG.md in the cache.
[2016-04-04T17:39:48+08:00] INFO: Storing updated cookbooks/setup_vm/metadata.rb in the cache.
[2016-04-04T17:39:48+08:00] INFO: Storing updated cookbooks/setup_vm/README.md in the cache.
- setup_vm (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
================================================================================
Recipe Compile Error in C:/chef/cache/cookbooks/setup_vm/recipes/default.rb
================================================================================
LoadError
---------
cannot load such file -- chef/provisioning
Running handlers:
[2016-04-04T17:39:48+08:00] ERROR: Running exception handlers
Running handlers complete
[2016-04-04T17:39:48+08:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 seconds
[2016-04-04T17:39:48+08:00] INFO: Sending resource update report (run-id: f0bbb00d-b757-4fcd-85ca-df854ba9e4fd)
[2016-04-04T17:39:48+08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2016-04-04T17:39:48+08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-04T17:39:48+08:00] FATAL: LoadError: cannot load such file -- chef/provisioning
This is the output from chef-stacktrace.out
Generated at 2016-04-04 17:39:48 +0800
LoadError: cannot load such file -- chef/provisioning
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/chef/cache/cookbooks/setup_vm/recipes/default.rb:10:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:332:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:167:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:509:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:277:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:60:in `load'
C:/opscode/chef/bin/chef-client:60:in `<main>'
What do I miss over here? Thanks. :)
Odd, that always worked for me when I used this driver. Regarding the recipe error, your node is missing the cher-provisioning gem.
Hi mwrock,
Thanks for your quick reply! I have installed the chef-provisioning in the node. I still can't solve the client.rb
being :verify_none
. I have to manually edit from :verify_peer
to :verify_none
. Another error from chef-stacktrace,out found in the node.
Generated at 2016-04-05 10:24:07 +0800
NoMethodError: private method `include' called for Chef::Resource::Machine:Class
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/cheffish-2.0.2/lib/cheffish.rb:117:in `node_attributes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:31:in `<class:Machine>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:8:in `<class:Resource>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:7:in `<class:Chef>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:6:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/recipe_dsl.rb:5:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning.rb:2:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:127:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:40:in `require'
C:/chef/cache/cookbooks/setup_vm/recipes/default.rb:10:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:332:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:167:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:509:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:277:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:60:in `load'
C:/opscode/chef/bin/chef-client:60:in `<main>'
This is chef-stacktrace.out from the workstation where I issue the command to provision the new VM.
Generated at 2016-04-05 09:53:41 +0800
RuntimeError: machine[server09] (setup_vm::default line 56) had an error: RuntimeError: Error: command 'chef-client -l info' exited with code 1.
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/winrm.rb:148:in `error!'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:31:in `block in execute'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `add_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:175:in `converge_by'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:54:in `perform_action'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:29:in `execute'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:59:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:56:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:55:in `converge'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:21:in `converge'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provider/machine.rb:67:in `block in <class:Machine>'
(eval):2:in `block in action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `instance_eval'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `compile_and_converge_action'
(eval):2:in `action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:73:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:104:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:668:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:702:in `converge_and_save'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:280:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:433:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `loop'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:412:in `run_application'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `load'
C:/opscode/chefdk/embedded/bin/chef-client:22:in `<main>'
Any ideas how to I proceed? Thanks.
Hi mwrock,
I would like to ask what version of chef-client did you use? These are the versions that I have used while I was doing provisioning:
I saw on this link and I thought they are quite similar. The chef-client installed on the node contained a ruby version of 2.0.0. I would like to ask could it be the embedded ruby that causes this problem?
Thanks.
My apologies for the delay getting back to you. I don't think this has anything to do with chef or ruby version. I just got some vsphere infra access and ran through a recipe and realized I gave you misinformation. The convergence_options
need to be outside the bootstrap_options
. Like this:
with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 4,
host: 'ESX_HOST_IP',
memory_mb: 4096,
network_name: ["MY_INTERNET_FOLDER"],
datastore: "MY_DATASTORE",
additional_disk_size_gb: [100],
datacenter: 'MY_DATASTORE',
template_name: 'WINDOWS_TEMPLATE',
customization_spec: {
ip: 'NEW_VM_IP',
subnetMask: 'NEW_VM_NETMASK',
gateway: 'NEW_VM_GATEWAY',
ipsettings: {
dnsServerList: ['DNS1','DNS2']
},
win_time_zone: 215,
domain: 'local',
org_name: 'my_org',
product_id: '',
hostname: 'server04'
},
:ssh => {
:user => 'administrator',
:password => 'NEW_VM_PASSWORD',
:paranoid => false,
}
},
convergence_options: {
ssl_verify_mode: :verify_none
}
That should set the right indo in your client.rb file and cause your node to ignore ssl validation errors.
Hi mwrock,
Thanks for the quick reply! I have tried to place the
convergence_options: {
ssl_verify_mode: :verify_none
}
outside the bootstrap_options
, it works. I can see that the client.rb
has the ssl_verify_mode: :verify_none
. However, the setting up of VM failed.
This is chef-stacktrace,out
inside the provisioned machine.
Generated at 2016-04-11 09:27:52 +0800
NoMethodError: private method `include' called for Chef::Resource::Machine:Class
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/cheffish-2.0.2/lib/cheffish.rb:117:in `node_attributes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:31:in `<class:Machine>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:8:in `<class:Resource>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:7:in `<class:Chef>'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/resource/machine.rb:6:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/recipe_dsl.rb:5:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning.rb:2:in `<top (required)>'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:127:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:40:in `require'
C:/chef/cache/cookbooks/setup_vm/recipes/default.rb:10:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:332:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/run_context.rb:167:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:509:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/client.rb:277:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:435:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application/client.rb:424:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-12.8.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:60:in `load'
C:/opscode/chef/bin/chef-client:60:in `<main>'
this is the chef-stacktrace.out
from my workstation that called the provisioned command.
Generated at 2016-04-11 08:57:58 +0800
RuntimeError: machine[server11] (setup_vm::default line 57) had an error: RuntimeError: Error: command 'chef-client -l info' exited with code 1.
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/winrm.rb:148:in `error!'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:31:in `block in execute'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/mixin/why_run.rb:52:in `add_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:175:in `converge_by'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:54:in `perform_action'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:29:in `execute'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:59:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:56:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/run_context.rb:527:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/chef_provider_action_handler.rb:59:in `open_stream'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/convergence_strategy/install_msi.rb:55:in `converge'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/machine/basic_machine.rb:21:in `converge'
C:/Users/iMerino/AppData/Local/chefdk/gem/ruby/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provider/machine.rb:67:in `block in <class:Machine>'
(eval):2:in `block in action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `instance_eval'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:360:in `compile_and_converge_action'
(eval):2:in `action_converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource.rb:596:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:73:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:105:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/runner.rb:104:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:668:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:663:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:702:in `converge_and_save'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/client.rb:280:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:228:in `block in run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:211:in `run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:433:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `loop'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:423:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application/client.rb:412:in `run_application'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/lib/chef/application.rb:58:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/bin/chef-client:60:in `load'
C:/opscode/chefdk/bin/chef-client:60:in `<main>'
How do I resolve this problem? Thanks.
The failure on the workstation is just saying that the chef-client run failed on the node.
The node failure looks like it is trying to converge a machine resource. Are you running a machine resource on the node to provision another machine?
Hi mwrock,
I am running on a physical workstation (Windows 10) that is running on ChefDK to provision a node located in the vCenter.
What run list are you setting on the provisioned node? Does it include your machine recipe and is that intentional?
Hi mwrock,
Thanks for your prompt reply!
I have one runlist and that is the default.rb
. Currently, the default.rb
is the one shown in this thread at this location except that I made changes to shift the convergence_options
outside the bootstrap_options
. The default.rb
that I have coded basically just do provisioning only.
The command I have issued to perform provisioning on my workstation is
chef-client -o 'setup_vm::provision' -c .\.chef\knife.rb
I have been trying to follow what is written on here since I am provisioning Windows 2012R2 and how I perform sysprep on the Windows node is followed this example before I turned it into a VM template.
Let me know if I miss out anything. :)
So I think the issue here is that you are using the same recipe to bootstrap the node that you are to provision it.
Since your recipie has:
machine "server09" do
run_list ['setup_vm::default']
end
Your worrkstation runs it to provision server09 and then once provisioned, server09 will converge with that recipie. So it really does not do provisioning only but rather provisions and then converges. The :converge
action is the default action on the machine resource if not specified. I believe you would want the :setup
action to just provision and install the chef client.
Hi mwrock,
i have made changes to what you have told me and it works! Thanks you so much! I have some questions with regards to the use of Chef that is outside of this thread. Is there anyone that I can talk to or can I email to you privately?
You can send questions to the chef-dev list at https://discourse.chef.io/
Hi,
I have encountered an error while provisioning a new Windows VM. The error from the chef-stacktrace.out is shown below.
any idea what the error means? Thanks.