Giter Site home page Giter Site logo

chef-provisioning-vsphere's People

Contributors

andrewelizondo avatar antonmarsden avatar bdupras avatar chrodriguez avatar mwrock avatar rhass avatar rj-reilly avatar rlanore avatar troyready avatar tshak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chef-provisioning-vsphere's Issues

Warnings after kitchen create

Hello,
I am currently using the chef-provisioning-vsphere as a Test-Kitchen driver for my PowerShell Desired State Configuraiton integration tests. With that said, I am not configuring anything related to Chef which may be the issue.

After running "kitchen create" and the machine is deployed, I get the following Warning:

[2016-01-26T15:04:12-05:00] WARN: chef_environment nil currently does not overwrite the value of chef_environment. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :chef_environment, [MyType, nil]", or stop setting this value to nil. at C:/Users/user/AppData/Local/chefdk/gem/ruby/2.1.0/gems/cheffish-1.6.0/lib/chef/resource/chef_node.rb:15:in `initialize'
[2016-01-26T15:04:12-05:00] WARN: chef_environment nil currently does not overwrite the value of chef_environment. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :chef_environment, [MyType, nil]", or stop setting this value to nil. at C:/Users/user/AppData/Local/chefdk/gem/ruby/2.1.0/gems/cheffish-1.6.0/lib/chef/resource/chef_node.rb:15:in `initialize'
create node AddDomain-win2012r2-vsphere-9cfcea12 at chefzero://localhost:8889
  add normal.chef_provisioning = {"reference"=>{"driver_url"=>"vsphere://vsphere.somedomain.com/sdk?use_ssl=true&insecure=true", "driver_version"=>"0.8.3", "server_id"=>"268f2518-cbcf-453c-9935-515b99bee089", "is_windows"=>true, "allocated_at"=>"2016-01-26 20:03:05 UTC", "ipaddress"=>"192.168.1.100"}}
  add normal.tags = nil

Here is the vsphere configuration in my .kitchen.yml file:

platforms:
  - name: win2012r2-vsphere
    driver_plugin: vsphere
    driver_config:
      driver_options:
        host: 'vsphere.somedomain.com'
        user: <%= ENV['VSPHERE_USER'] %>
        password: <%= ENV['VSPHERE_PASSWORD'] %>
        insecure: true
      machine_options:
        ready_timeout: 180
        bootstrap_options:
          use_linked_clone: true
          datacenter: 'Some Datacenter'
          template_name: 'win12r2wmf5'
          template_folder: 'DSC'
          vm_folder: 'DSC'
          ssh:
            user: vagrant
            password: vagrant

I appreciate any help, and thank you for this plugin, it is fantastic.

Support for provisioning Straight to ESXI

I came across your driver and was super excited... I was going to use it to provision all of our resources on our new project starting with the chef-server! It seems as though it doesn't support just Plain ESXI 5.5. It seems to authenticate but then it can't find the templates. So I started looking more and things like dataceter are required ( don't believe that is a ESXI thing that is a vsphere thing) Is there any intention to support just ESXI in the near future?

Add network card

Hello,
I would like to add a NIC during provisioning. However, I do not find the solution.
Thanks for your help,
good night

Chef-client Version

Hi all,

Has anyone been able to specify the chef-client version with the :convergence_options :install_msi_url option? I keep getting the latest version (12.5.1) no matter what I put. Below is my config. I'm pulling in my machine options from a data bag:

  node_spec = data_bag_item('nodes', 'test-ian-blank-01')

  require "chef/provisioning/vsphere_driver"
  with_vsphere_driver host: node_spec['vsphere']['vsphere_host'],
    insecure: true,
    user:     'some_user',
    password: 'some_pass'

 with_machine_options :bootstrap_options => {
    num_cpus: node_spec['vsphere']['num_cpus'],
    memory_mb: node_spec['vsphere']['memory_mb'],
    network_name: node_spec['vsphere']['networks'],
    datacenter: node_spec['vsphere']['datacenter'],
    datastore: node_spec['vsphere']['datastore'],
    additional_disk_size_gb: node_spec['vsphere']['additional_disk_size_gb'],
    host: node_spec['vsphere']['host'],
    template_name: node_spec['vsphere']['template'],
    :ssh => {
      :user => 'some_user',
      :password => 'some_pass',
      :paranoid => false
    },
    customization_spec: {
      ipsettings: {
        ip: node_spec['vsphere']['ipaddress'],
        subnetMask: node_spec['vsphere']['netmask'],
        gateway: node_spec['vsphere']['gateway'],
        dnsServerList: node_spec['vsphere']['nameservers'],
      },
      :domain => node_spec['vsphere']['domain'],
    }
  }, :convergence_options => {
    #:ssl_verify_mode => :verify_none,
    :install_msi_url => 'https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.4.3-1.el6.x86_64.rpm'
  }, :sudo => true

  require 'chef/provisioning'
  # env = node.chef_environment

  with_chef_server node['chef']['server_url'],
    :client_name => Chef::Config[:node_name],
    :signing_key_filename => Chef::Config[:client_key]

  machine node_spec['id'] do
    chef_environment node_spec['env']
    run_list node_spec['vsphere']['run_list']
    file "/etc/chef/encrypted_data_bag_secret", "#{ENV['HOME']}/.chef/encrypted_data_bag_secret"
    converge true
  end

Provision Windows - Network Unreachable

We are provisioning a Windows server with custom specs. The cloning works, the server is powered on with a disconnected network. It seems like the customizations are then applied, and the vm is rebooted. After it restarts, the network in vpshere shows 'connected', after a few seconds the hostname will show in vpshere and the command line will say wnexttest2 is now ready, but vpshere shows no ip yet. The provisioning then fails with Errno::ENETUNREACH Network is unreachable - connect(2) for "10.200.2.78" port 5985 (http://10.200.2.78:5985). A few seconds later and vpshere shows a 169.x.x.x ip address. Then, a minute or so later it shows the actual ip address we set in the customization. A linux provisioning works fine, just this issue with Windows. Also, once the vm shows the correct ip, if i re-run the provisioning...it will bootstrap it fine.

    - creating machine wnexttest2 on vsphere://xxx.net/sdk?use_ssl=true&insecure=true
    -   start_timeout: 600
    -   create_timeout: 600
    -   ready_timeout: 1000
    -   use_linked_clone: false
    -   customization_spec: {:org_name=>"XXX", :time_zone=>"America/New_York", :win_time_zone=>35, :product_id=>"xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", :ipsettings=>{:ip=>"10.200.2.78", :subnetMask=>"255.255.255.0", :gateway=>["10.200.2.1"], :dnsServerList=>["10.200.1.43", "10.200.1.44"]}, :domain=>"local", :hostname=>"wnexttest2"}
    -   ssh: {:paranoid=>false, :user=>"xxx", :password=>"xxx"}
    -   vm_folder: "Dev Env/DevOps/Next"
    -   datacenter: "powerdms.net"
    -   datastore: "vm_vol_1"
    -   resource_pool: "hq"
    -   template_folder: "Templates"
    -   template_name: "win2k12base"   **This is Windows 2012 R2 with all latest updates applied**
    -   network_name: ["VLAN_202_PDMSSvr"]
    -   num_cpus: 2
    -   memory_mb: 4096
    - finding networks...
    - network: VLAN_202_PDMSSvr is a Network
    - changing template nic for VLAN_202_PDMSSvr
    - customizing wnexttest2               with static IP 10.200.2.78
    - customizing wnexttest2 with /
                  dynamic IP and DNS: ["10.200.1.43", "10.200.1.44"]

screen shot 2015-09-28 at 3 51 57 pm

screen shot 2015-09-28 at 3 45 52 pm

screen shot 2015-09-28 at 3 48 05 pm

Here are my chef gem versions when running chef gem list:

chef (12.4.1)
chef-config (12.4.1)
chef-dk (0.7.0)
chef-provisioning (1.4.0, 1.3.0)
chef-provisioning-aws (1.3.1)
chef-provisioning-azure (0.3.2)
chef-provisioning-fog (0.13.2)
chef-provisioning-vagrant (0.9.0)
chef-provisioning-vsphere (0.8.1)
chef-vault (2.6.1)
chef-zero (4.2.3, 1.5.6)

The template is a Windows 2012 R2 with all the latest updates and the latest VM tools installed. Is there something else that needs to be setup on the template maybe?

Windows 2012 R2 Kitchen cspec

Hey,

Does anyone know of a way to use an existing vsphere customisation to do the sysprep/domain config of a kitchen virtual machine?

i keep running into this issue and i'm pretty sure if I can get around the domain join then this would be resolve!

   Finished creating <Kitchen-windows-2012r2> (1m35.05s).

-----> Converging ...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 4.1.1...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
[WinRM] connection failed, retrying in 1 seconds (#<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>)
[WinRM] connection failed, retrying in 1 seconds (#<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>)
[WinRM] connection failed, retrying in 1 seconds (#<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>)
[WinRM] connection failed, retrying in 1 seconds (#<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>)
$$$$$$ [WinRM] connection failed, terminating (#<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>)

------Exception-------
Class: Kitchen::ActionFailed

Message: Failed to complete #converge action: [WinRM::WinRMAuthorizationError]

Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

ssh key support?

Hi,

for our testing we need the user that provisions the VM to have a SSH key. Somehow I am not able to find any useful information on this when doing a google search. Is there an option to provide the ssh key in the kitchen config?

Cheers,
Stefan

Automatically connect network

Hi,

I have the problem that the network card is not being connected automatically on kitchen setup. Is there an Option for this?

Cheers,
Stefan

Issues with template path

Hey I have been working on Chef-provision over Vsphere...

chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end

require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: 'zzzzz',
insecure: true,
user: 'xxxx',
password: 'yyyy'

with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 2,
memory_mb: 4096,
network_name: ["dc-hw-vms"],
datacenter: 'Horizon',
cluster: 'Horizon Suite',
resource_pool:'darshan-rp',
template_name:'w1-hs-vc02/Horizon/Shared Templates/Misc/Ubuntu12.04_x64_srv_Template',
customization_spec: {
ipsettings: {
dnsServerList: ['10.142.28.1','10.33.4.1','10.33.4.2']
},
:domain=> 'hs.trcint.com'
},
:ssh => {
:user => 'root',
:password => 'password',
:paranoid => false,
}

}
machine "Darshan" do
run_list ['workspace_provisioning::default']
end

log file:

[2015-07-12T10:09:53-07:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.4.0.rc.0
[2015-07-12T10:09:53-07:00] INFO: *** Chef 12.4.0.rc.0 ***
[2015-07-12T10:09:53-07:00] INFO: Chef-client pid: 15377
[2015-07-12T10:09:55-07:00] INFO: Run List is []
[2015-07-12T10:09:55-07:00] INFO: Run List expands to []
[2015-07-12T10:09:55-07:00] INFO: Starting Chef Run for dtumkursreeni
[2015-07-12T10:09:55-07:00] INFO: Running start handlers
[2015-07-12T10:09:55-07:00] INFO: Start handlers complete.
[2015-07-12T10:09:55-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
resolving cookbooks for run list: []
[2015-07-12T10:09:55-07:00] INFO: Loading cookbooks []
Synchronizing Cookbooks:
Compiling Cookbooks...
Recipe: @recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-12T10:09:55-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb line 1)
    (up to date)
    [2015-07-12T10:09:57-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-12T10:09:57-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-12T10:09:57-07:00] WARN: Chef::Resource::Machine is marked as providing DSL machine, but provides :machine was never called!
    [2015-07-12T10:09:57-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
    [2015-07-12T10:09:57-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-12T10:09:57-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-12T10:09:57-07:00] WARN: Node dtumkursreeni has an empty run list.
    Converging 2 resources

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-12T10:09:57-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb line 1)
    (up to date)

  • machine[Darshan] action converge[2015-07-12T10:09:57-07:00] INFO: Processing machine[Darshan] action converge (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb line 77)
    [2015-07-12T10:09:57-07:00] WARN: Class Chef::Provider::Machine does not declare 'provides :machine'.
    [2015-07-12T10:09:57-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-12T10:09:57-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/Darshan

    • creating machine Darshan on vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true
    • use_linked_clone: true
    • num_cpus: 2
    • memory_mb: 4096
    • network_name: ["dc-hw-vms"]
    • datacenter: "Horizon"
    • cluster: "Horizon Suite"
    • resource_pool: "darshan-rp"
    • template_name: "w1-hs-vc02/Shared Templates/Misc/Ubuntu12.04_x64_srv_Template"
    • customization_spec: {:ipsettings=>{:dnsServerList=>["10.142.28.1", "10.33.4.1", "10.33.4.2"]}, :domain=>"hs.trcint.com"}
    • ssh: {:user=>"root", :password=>"password", :paranoid=>false}establishing connection to 10.141.159.241

    Error executing action converge on resource 'machine[Darshan]'

    RuntimeError

    vSphere VM Template not found [/w1-hs-vc02/Shared Templates/Misc/Ubuntu12.04_x64_srv_Template]

    Resource Declaration:

    In /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb

    77: return send(method_symbol, *args, &block)
    78: end

    Compiled Resource:

    Declared in /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb:77:in `method_missing'

    machine("Darshan") do
    action [:converge]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    chef_server {:chef_server_url=>"chefzero://localhost:8889", :options=>{:client_name=>"dtumkursreeni", :signing_key_filename=>"/Users/dtumkursreeni/.chef/dtumkursreeni.pem"}}
    driver "vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true"
    machine_options {:bootstrap_options=>{:use_linked_clone=>true, :num_cpus=>2, :memory_mb=>4096, :network_name=>["dc-hw-vms"], :datacenter=>"Horizon", :cluster=>"Horizon Suite", :resource_pool=>"darshan-rp", :template_name=>"w1-hs-vc02/Shared Templates/Misc/Ubuntu12.04_x64_srv_Template", :customization_spec=>{:ipsettings=>{:dnsServerList=>["10.142.28.1", "10.33.4.1", "10.33.4.2"]}, :domain=>"hs.trcint.com"}, :ssh=>{:user=>"root", :password=>"password", :paranoid=>false}}}
    declared_type :machine
    cookbook_name "@recipe_files"
    recipe_name "/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb"
    run_list ["workspace_provisioning::default"]
    end

[2015-07-12T10:09:59-07:00] INFO: Running queued delayed notifications before re-raising exception

Running handlers:
[2015-07-12T10:09:59-07:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-12T10:09:59-07:00] ERROR: Exception handlers complete
[2015-07-12T10:09:59-07:00] FATAL: Stacktrace dumped to /Users/dtumkursreeni/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 5.820475 seconds
[2015-07-12T10:09:59-07:00] ERROR: machine[Darshan](@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere.rb line 77) had an error: RuntimeError: vSphere VM Template not found [/w1-hs-vc02/Shared Templates/Misc/Ubuntu12.04_x64_srv_Template]
[2015-07-12T10:09:59-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
dtumkursreeni-mac:recipes dtumkursreeni$

New machines are always rebooted after provision

Each new machine I bring up is rebooted before it's converged. This increases my runtime significantly.

I've commented out this section of code as a test, and provisioning runs fine without a reboot:

restart_server(action_handler, machine_spec, machine_options)

Before I submit a PR to change this behavior, can someone educate me on why this driver reboot each machine after it comes up for the first time? Is it working around some issues in vSphere that I'm haven't run into?

DNS server required in customization spec when using dhcp?

DNS Server settings seem to be required when provisioning from a customization spec when using DHCP, even though the DHCP server can assign them. When not specifying DNS servers I received an error (nil for nilclass if I recall) on line 111 in
chef-provisioning-vsphere / lib / chef / provisioning / vsphere_driver / clone_spec_builder.rb

Cheffish::MergedConfig - Unexpected method delete for MergedConfig with arguments [:remote_forwards]

Good Day,

I am trying to use the chef-provisioning-vsphere driver to create virtual machines. However, the class SSH < Chef::Provisioning::Transport is encountering an error trying to get the remote_forwards attribute. I did some digging through the current versions of the gems that I am using:

chef-provisioning (1.6.0)
chef-provisioning-vsphere (0.8.3)
cheffish (2.0.2, 2.0.1)

The problem is that the SSH class initialize method expects a hash of parameters in the ssh_options but the chef-provisioning-vsphere gem passes it a Cheffish::MergedConfig object. When the new object is initialized, the remote_forwards key is deleted from the ssh_options object. This throws the method_missing error in the title because the MergedConfig object does not implement that method.

Please advise.

Permissions on vSphere - find_datacenter?

This might be more of a question than an issue but I seem to be fighting with some permission issues. I am attempting to use the vsphere driver with test-kitchen and but I am getting the following error.

creating machine kitchen-6a09bec0 on vsphere://vcenter.my-vcenter.com/sdk?use_ssl=true&insecure=true
  use_linked_clone: true
  datacenter: "Portland"
  datastore: "esx-p01:VM1 & ISO (POR)"
  host: "esx-p01.my-vcenter.com"
  template_name: "tk-ubuntu-1404"
  num_cpus: 2
  network_name: ["VM Traffic"]
  memory_mb: 4096
  resource_pool: "/Portland/host/esx-p01.my-vcenter.com/Resources/VMSetup (POR)"
  ssh: {:user=>"opsadmin", :paranoid=>false, :password=>"my_pass", :port=>22}
establishing connection to vcenter.my-vcenter.com
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [NoPermission: Permission to perform this operation was denied.]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #create action: [NoPermission: Permission to perform this operation was denied.]
D      ---Nested Exception---
D      Class: RbVmomi::Fault
D      Message: NoPermission: Permission to perform this operation was denied.
D      ------Backtrace-------
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:61:in `parse_response'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:90:in `call'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in `_call'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:in `block (2 levels) in init'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Folder.rb:7:in `find'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Folder.rb:93:in `traverse'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/ServiceInstance.rb:8:in `find_datacenter'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb:84:in `datacenter'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb:73:in `find_folder'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb:38:in `find_vm'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/chef/provisioning/vsphere_driver/driver.rb:166:in `find_or_create_vm'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/chef/provisioning/vsphere_driver/driver.rb:135:in `allocate_machine'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/kitchen/driver/vsphere.rb:37:in `block in create'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/kitchen/driver/vsphere.rb:69:in `call'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/kitchen/driver/vsphere.rb:69:in `with_provisioning_driver'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/chef-provisioning-vsphere-0.8.1/lib/kitchen/driver/vsphere.rb:36:in `create'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:424:in `public_send'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:424:in `block in perform_action'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `call'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `synchronize_or_call'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:453:in `block in action'
D      /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:452:in `action'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:424:in `perform_action'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:352:in `create_action'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:341:in `block in transition_to'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `each'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `transition_to'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:138:in `converge'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `public_send'
D      /Users/kpettijohn/.gems/ruby/2.0.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
D      ----------------------

Here is my configuration:

driver:
  driver_options:
    name: vsphere
    user: 'kpettijohn'
    host: 'vcenter.my-vcenter.com'
    password: 'my_pass'
    insecure: true
  machine_options:
    start_timeout: 600
    create_timeout: 600
    ready_timeout: 90
    bootstrap_options:
      use_linked_clone: true
      datacenter: 'Portland'
      datastore: 'esx-p01:VM1 & ISO (POR)'
      host: 'esx-p01.my-host.com'
      template_name: 'tk-ubuntu-1404'
      num_cpus: 2
      network_name:
        - 'VM Traffic'
      memory_mb: 4096
      resource_pool: '/Portland/host/esx-p01.my-host.com/Resources/VMSetup (POR)'
      ssh:
        user: opsadmin
        paranoid: false
        password: my_pass
        port: 22

I came across an issue from rbvmomi (rlane/rbvmomi/issues/19), which might be related to what I am experiencing. Any suggestions/ideas would be greatly appreciated!

Running kitchen create multiple times creates multiple VMs

Ahoy hoy,

I've recently switched from the now discontinued kitchen-vsphere driver to this one and came across an issue today: If you run kitchen create multiple times, it clones a new VM every time, leaving the one created before in a state that is no longer manageable with testkitchen commandline tools. You need to login to the vSphere Client and shutdown/delete the previously created machines by hand.

I originally stumbled across it because I changed the "memory_mb" and wondered if it would change the allocated memory on an already created machine. I then tested it with no changes to the .kitchen.yml, but it still creates a new VM every time I run kitchen create.

Here is my (redacted) .kitchen.yml:

---
driver_plugin: vsphere
driver_config:
  driver_options:
    host: ***
    user: ***
    password: ***
    insecure: true
  machine_options:
    start_timeout: 600
    create_timeout: 600
    ready_timeout: 90
    bootstrap_options:
      datacenter: ***
      resource_pool: 'Test'
      template_folder: 'Test/Chef-Testumgebung/Testkitchen/Templates'
      vm_folder: 'Test/Chef-Testumgebung/Testkitchen'
      memory_mb: 2048
      ssh:
        user: ***
        password: ***
        paranoid: false

provisioner:
  name: chef_zero

platforms:
  - name: sles11
    driver_config:
      machine_options:
        bootstrap_options:
          template_name: 'testkitchen-sles11-chef11-minimal'

Steps to reproduce: Use the testkitchen driver as described here and run kitchen create twice without running kitchen destroy in between.

Net::SSH::AuthenticationFailed(VMs are getting created in Vsphere, but not able to SSH VMs. )

VMs are getting created in Vsphere, but not able to SSH VMs.

dtumkursreeni-mac:recipes dtumkursreeni$ chef-client -z vsphere_config.rb
[2015-07-14T10:02:02-07:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /Users/dtumkursreeni/chef
One version per cookbook

[2015-07-14T10:02:02-07:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.4.0.rc.0
[2015-07-14T10:02:02-07:00] INFO: *** Chef 12.4.0.rc.0 ***
[2015-07-14T10:02:02-07:00] INFO: Chef-client pid: 11299
[2015-07-14T10:02:04-07:00] INFO: Run List is []
[2015-07-14T10:02:04-07:00] INFO: Run List expands to []
[2015-07-14T10:02:04-07:00] INFO: Starting Chef Run for dtumkursreeni
[2015-07-14T10:02:04-07:00] INFO: Running start handlers
[2015-07-14T10:02:04-07:00] INFO: Start handlers complete.
[2015-07-14T10:02:04-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
resolving cookbooks for run list: []
[2015-07-14T10:02:04-07:00] INFO: Loading cookbooks []
Synchronizing Cookbooks:
Compiling Cookbooks...
Recipe: @recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-14T10:02:04-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 1)
    (up to date)
    [2015-07-14T10:02:50-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-14T10:02:50-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T10:02:50-07:00] WARN: Chef::Resource::Machine is marked as providing DSL machine, but provides :machine was never called!
    [2015-07-14T10:02:50-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
    [2015-07-14T10:02:50-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-14T10:02:50-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T10:02:50-07:00] WARN: Node dtumkursreeni has an empty run list.
    Converging 2 resources

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-14T10:02:50-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 1)
    (up to date)

  • machine[workspace] action converge[2015-07-14T10:02:50-07:00] INFO: Processing machine[workspace] action converge (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 77)
    [2015-07-14T10:02:50-07:00] WARN: Class Chef::Provider::Machine does not declare 'provides :machine'.
    [2015-07-14T10:02:50-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T10:02:50-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/workspace

    • creating machine workspace on vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true
    • use_linked_clone: true
    • num_cpus: 2
    • memory_mb: 4096
    • network_name: ["wdc-hw-vms"]
    • datacenter: "Horizon"
    • cluster: "Horizon Suite"
    • resource_pool: "Horizon Suite/darshan-rp"
    • template_folder: "Shared Templates/SaaS"
    • template_name: "ws-empty-vm_v3"
    • customization_spec: {:ipsettings=>{:dnsServerList=>["10.142.28.1", "10.33.4.1", "10.33.4.2"]}, :domain=>"hs.trcint.com"}
    • ssh: {:user=>"root", :password=>"root", :paranoid=>false}establishing connection to 10.141.159.241
      [2015-07-14T10:04:27-07:00] WARN: Using a VM Template, ignoring use_linked_clone.
    • network: wdc-hw-vms is a DistributedVirtualPortgroup
    • changing template nic for wdc-hw-vms
    • customizing workspace with /
      dynamic IP and DNS: ["10.142.28.1", "10.33.4.1", "10.33.4.2"]
    • Machine - created - workspace (5020067a-20f7-9c70-194a-e59d8b64e7b2 on vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true)[2015-07-14T10:05:24-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T10:05:24-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T10:05:24-07:00] WARN: Chef::Resource::ChefNode is marked as providing DSL chef_node, but provides :chef_node was never called!
      [2015-07-14T10:05:24-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
      [2015-07-14T10:05:24-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T10:05:24-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T10:05:24-07:00] INFO: Processing chef_node[workspace] action create (basic_chef_client::block line 77)
      [2015-07-14T10:05:24-07:00] WARN: Class Chef::Provider::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T10:05:24-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T10:05:24-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/workspace
    • create node workspace at chefzero://localhost:8889
    • add normal.tags = nil
    • add normal.chef_provisioning = {"reference"=>{"driver_url"=>"vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true", "driver_version"=>"0.5.8", "server_id"=>"5020067a-20f7-9c70-194a-e59d8b64e7b2", "is_windows"=>false, "allocated_at"=>"2015-07-14 17:05:17 UTC", "ipaddress"=>nil}}
    • update run_list from [] to ["workspace_provisioning::default"]
    • Power on VM [vm/workspace]
    • waiting for workspace (5020067a-20f7-9c70-194a-e59d8b64e7b2 on vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true) to be ready ..............
    • workspace is now ready[2015-07-14T10:06:50-07:00] INFO: Executing pwd on [email protected]
    • waiting up to 300 seconds for customization
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • IP addresses found: ["10.142.29.63", "fe80::250:56ff:fea0:801f"]
    • rebooting...
    • Shutdown guest OS and power off VM [vm/workspace]
    • Power on VM [vm/workspace]
    • restart machine workspace (vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true)
    • waiting up to 300 seconds for customization
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP addresses found: []
    • IP address obtained: 10.142.29.63[2015-07-14T10:13:41-07:00] INFO: Executing pwd on [email protected]
      [email protected]'s password:
    • waiting for workspace (5020067a-20f7-9c70-194a-e59d8b64e7b2 on vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true) to be connectable (transport up and running) ...[2015-07-14T10:20:48-07:00] INFO: Executing pwd on [email protected]
      [email protected]'s password:
      [email protected]'s password:
      .[2015-07-14T10:22:21-07:00] INFO: Executing pwd on [email protected]
      [email protected]'s password:
      [email protected]'s password:
      .
    • workspace is now connectable[2015-07-14T10:23:47-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T10:23:47-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T10:23:47-07:00] INFO: Processing chef_node[workspace] action create (basic_chef_client::block line 57)
      [2015-07-14T10:23:47-07:00] WARN: Class Chef::Provider::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T10:23:47-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    • update node workspace at chefzero://localhost:8889
    • update normal.chef_provisioning.reference.ipaddress from nil to "10.142.29.63"
    • add normal.chef_provisioning.reference.started_at = "2015-07-14 17:12:34 UTC"
    • update run_list from ["recipe[workspace_provisioning::default]"] to ["workspace_provisioning::default"]
      [email protected]'s password:
      [email protected]'s password:

    Error executing action converge on resource 'machine[workspace]'

    Net::SSH::AuthenticationFailed

    Authentication failed for user [email protected]

    Resource Declaration:

    In /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb

    77: return send(method_symbol, *args, &block)
    78: end

    Compiled Resource:

    Declared in /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb:77:in `method_missing'

    machine("workspace") do
    action [:converge]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    chef_server {:chef_server_url=>"chefzero://localhost:8889", :options=>{:client_name=>"dtumkursreeni", :signing_key_filename=>"/Users/dtumkursreeni/.chef/dtumkursreeni.pem"}}
    driver "vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true"
    machine_options {:bootstrap_options=>{:use_linked_clone=>true, :num_cpus=>2, :memory_mb=>4096, :network_name=>["wdc-hw-vms"], :datacenter=>"Hor", :cluster=>"Horizon Suite", :resource_pool=>"Horizon Suite/darshan-rp", :template_folder=>"S", :template_name=>"ws", :customization_spec=>{:ipsettings=>{:dnsServerList=>[""]}, :domain=>"hs.trcint.com"}, :ssh=>{:user=>"root", :password=>"root", :paranoid=>false}}}
    declared_type :machine
    cookbook_name "@recipe_files"
    recipe_name "/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb"
    run_list ["workspace_provisioning::default"]
    end

[2015-07-14T10:24:16-07:00] INFO: Running queued delayed notifications before re-raising exception

Running handlers:
[2015-07-14T10:24:16-07:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-14T10:24:16-07:00] ERROR: Exception handlers complete
[2015-07-14T10:24:16-07:00] FATAL: Stacktrace dumped to /Users/dtumkursreeni/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 1334.279729 seconds
[2015-07-14T10:24:16-07:00] ERROR: machine[workspace](@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 77) had an error: Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]

how do i bootstrap the newly created node to connect to the chef server instead of localhost (chef zero)

Hi, used the chef-provisoining-vspshere plugin to create a VM on vcenter with the recipe using chef zero from a mac workstation.. however the created Vm (node) is trying to connect to http://localhost:8889 during bootstrap instead of my my chef server.. how do i make the new created VM (node) bootstrap and connect to my chef server

with_machine_options :bootstrap_options => {

use_linked_clone: true,

num_cpus: 1,
memory_mb: 2048,
network_name: ["VM Network"],
datacenter: 'east-dc',
resource_pool: 'my-cluster',
template_name: 'c7-template-v1',
:ssh => {
:user => 'xx',
:password => 'xx',
:paranoid => false
}
},
:sudo => true
}

Looking for a bootstrapping option to set the hostname inside a VM.

All,
Prior to migrating to chef-provisioning-vsphere, I used knife-vsphere. In knife-vsphere there seems to be several more VMware options available compared to chef-provisioning-vsphere. (See https://github.com/ezrapagel/knife-vsphere#knife-vsphere-vm-clone-new-vm-name-template-source-template-name-cspec-customization_spec for that list.)

In particular, I really want to be able to set the hostname of the Ubuntu instance that I spin up in vCenter. At the moment, there does not seem to be a [:customization_spec][:hostname] bootstrapping option. Is there any roadmap for "--chostname CUST_HOSTNAME" (or any other, like "--dest-folder FOLDER" or "--cspec CUST_SPEC" or "--ctz CUST_TIMEZONE") option support?

[With a little bit of guidance, being I'm a relative Chef/chef-provisoining/Ruby newbie, I'd even be willing to help with the any options expansion efforts. ]

Cheers... Mark

Kitchen VM creates and works until the IP change is attemped

I've watched the process, the VM starts and works but has the template IP. It then reboots and attempts to change the IP and won't start with an error stating that it could not parse or process the unattend file. The machine is then just stuck on a loop where it reboots with an error stating that there was a problem with the installation. If I use regedit to change the following value HKLocal machine/SYSTEM/SETUP/STATUS/ChildCompletion/setup.exe to 3 it will boot with everything working fine including the IP.

The unattend.xml before IP change and after is the same except for the mac address. Can you actually set an IP in the kitchen.yml file? It works fine if you leave the IP alone but this leaves my testing limited to one VM at a time unless I have loads of templates.

My config:


---
driver_plugin: vsphere
driver_config:
  driver_options:
    host: 'vcentre.host.net'
    user: 'gwhiting'
    password: 'password'
    insecure: true
  machine_options:
    start_timeout: 600
    create_timeout: 600
    ready_timeout: 600
    bootstrap_options:
      use_linked_clone: true
      template_name: 'vsphere-test'
      template_folder: 'Ops Test Lab/Gregs Sandbox/'
      vm_folder: 'Ops Test Lab/Gregs Sandbox/'
      datacenter: 'GS-Datacenter'
      num_cpus: 2,
      network_name:
        - VLAN-36
      memory_mb: 4096
      resource_pool: pex-vmware07.host.net
      datastore: v7000-vmware-uat12
      ssh:
        user: Administrator
        paranoid: false
        password: 'adminpw'
        port: 22
      convergence_options:
      customization_spec:
        ipsettings:
          ip: '10.128.36.186'
          subnetMask: '255.255.255.0'
          gateway:
            - 10.128.36.1
          dnsServerList:
              - 172.16.36.121
              - 172.16.36.123
        domain: my_domain.local
        domainAdmin: administrator@my_domain.local
        domainAdminPassword: my_password
        org_name: my_org
        product_id: 11111-22222-33333-44444-55555
        win_time_zone: 4

provisioner:
  name: chef_zero

platforms:
  - name: WindowsServer2012R2x64v1_2
    transport: 
      name: winrm
    driver:
       guest: windows

suites:
  - name: default
    run_list:
      - recipe[bg-chocolatey::default]

Support for vcloud

I was just wondering if there is any intention to support vcloud or if this would technically already work. I know there is knife-vcair but it is just "different" in how it handles provisioning.

If anybody more knowledgeable could chime in I would really appreciate it.

Retrieving Ohai Attributes from Provisioned Node?

I have a need to retrieve the node mac address so I can statically assign the node an IP through DHCP.

Is there a way to callout to the node during provisioning and retrieve the mac address?

The AWS driver can do something like this...
Chef::Resource::AwsInstance.get_aws_object()

Datastore ISO file for CD/DVD Drive

cd-dvdoption
Hello,

I was looking over the bootstrap options for an option to mount an ISO on a datastore as a CD/DVD Drive and have it connected/Connect at power on. I wasn't able to see any on there. Would this be possible to do using the driver or should we look into achieving this through a different method such as using powershell?

Thanks,

RuntimeError: expected HostSystem for 'host', got array

Hello,

I'm running into a roadblock whenever trying to test out provisioning using vCenter in my home lab. It's probably something I'm doing wrong, but I thought I'd see if someone can help.

ChefDK: 0.6.0
vCenter 6.0

There are no clusters or resource pools setup, thus I'm trying to utilize the :host parameter. Could be because I'm running vCenter 6.0, but wanted to confirm before doing any downgrading or rebuilding. Thanks in advance.

Error message:

[2015-06-10T21:18:36-05:00] FATAL: RuntimeError: machine [my_machine_name](vcenter_provisioning_test::provision line 42) had an error: RuntimeError: expected HostSystem for 'host', got array

::provision recipe

chef_gem 'chef-provisioning-vsphere' do
  action :install
  compile_time true
end

require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: '192.168.1.112',
  insecure: true,
  user:     '****',
  password: '****'

with_machine_options :bootstrap_options => {
  use_linked_clone: true,
  num_cpus: 1,
  memory_mb: 4096,
  network_name: ['VM Network'],
  datacenter: 'Home',
  host: '192.168.1.100',
  datastore: 'esxlab_storage',
  template_name: 'WIN2008R2PS4',
  customization_spec: {
    ipsettings: {
      dnsServerList: ['192.168.1.110','192.168.1.1']
    },
    domain: 'casa.local',
    domainAdmin: '[email protected]',
    domainAdminPassword: '****',
    org_name: 'Casa',
    win_time_zone: 20
  },
  ssh: {
    user: 'Administrator',
    password: '****',
    paranoid: false,
  }
},
:convergence_options => {
  :ssl_verify_mode => :verify_none
}

machine "my_machine_name" do
  run_list ['vcenter_provisioning_test::default']
end

Stack trace

Generated at 2015-06-10 21:18:36 -0500
RuntimeError: machine[my_machine_name](vcenter_provisioning_test::provision line 42) had an error: RuntimeError: expected HostSystem for 'host', got array
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:129:in obj2xml' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:146:inblock (2 levels) in obj2xml'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:142:in each' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:142:inblock in obj2xml'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in call' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in_nested_structures'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in tag!' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:141:inobj2xml'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:146:in block (2 levels) in obj2xml' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:142:ineach'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:142:in block in obj2xml' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:incall'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in _nested_structures' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:intag!'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:141:in obj2xml' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:47:inblock (2 levels) in emit_request'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:42:in each' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:42:inblock in emit_request'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in call' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in_nested_structures'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in tag!' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:40:inemit_request'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:83:in block in call' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:71:inblock (2 levels) in soap_envelope'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in call' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in_nested_structures'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in tag!' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:70:inblock in soap_envelope'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in call' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in_nested_structures'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in tag!' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:64:insoap_envelope'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:82:in call' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in_call'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:in block (2 levels) in init' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb:169:indo_vm_clone'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:494:in clone_vm' C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:177:infind_or_create_vm'
C:/Users/Matthew/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:135:in allocate_machine' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.1.1/lib/chef/provider/machine.rb:30:inblock in class:Machine'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in instance_eval' C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:inrecipe_eval_with_update_check'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:in block in action' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.1.1/lib/chef/provider/machine.rb:37:inblock in class:Machine'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in instance_eval' C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:inrecipe_eval_with_update_check'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:in block in action' C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.1.1/lib/chef/provider/machine.rb:55:inblock in class:Machine'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in instance_eval' C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:inrecipe_eval_with_update_check'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:in block in action' C:/opscode/chefdk/embedded/apps/chef/lib/chef/provider.rb:130:inrun_action'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource.rb:562:in run_action' C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:49:inrun_action'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:in block (2 levels) in converge' C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:ineach'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:in block in converge' C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:inblock in execute_each_resource'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in call' C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:initerate'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:inexecute_each_resource'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:80:in converge' C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:339:inblock in converge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:334:in catch' C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:334:inconverge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:353:in converge_and_save' C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:457:inrun'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:253:in run_with_graceful_exit_option' C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:230:inblock in run_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:39:in with_server_connectivity' C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:213:inrun_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/client.rb:402:in block in interval_run_chef_client' C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/client.rb:392:inloop'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/client.rb:392:in interval_run_chef_client' C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/client.rb:382:inrun_application'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:60:in run' C:/opscode/chefdk/embedded/apps/chef/bin/chef-client:26:in<top (required)>'
C:/opscode/chefdk/bin/chef-client:63:in load' C:/opscode/chefdk/bin/chef-client:63:in

'

CHEF server (Help)

We are facing some issues with Chef-Zero so is it possible to point toward chef-server instead of local repo.

<class:KnifeVspherePlugin>': undefined method `with_vsphere_driver' for KnifeVspherePlugin:Class (NoMethodError)

Hi,
When i use your basic recipe i go this error (all vSphere Plugin are installed):

image

chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end

require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: 'vcenter-host-name',
insecure: true,
user: 'you_user_name',
password: 'your_mothers_maiden_name'

with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 2,
memory_mb: 4096,
network_name: ["vlan_20_172.21.20"],
datacenter: 'datacenter_name',
resource_pool: 'cluster',
template_name: 'path to template',
customization_spec: {
ipsettings: {
dnsServerList: ['1.2.3.31','1.2.3.41']
},
:domain => 'local'
}
:ssh => {
:user => 'root',
:password => 'password',
:paranoid => false,
}
}

machine "my_machine_name" do
run_list ['my_cookbook::default']
end

Thank's,
Regards,
Mlckha

Support multi-threading in kitchen testing

Moving test-kitchen/test-kitchen#710 to here for the appropriate fix. Test Kitchen already exposes multiple ways of locking on a mutex to ensure each Test Kitchen instance doesn't wreck other instances when they need to share context.

There is a pre-create hook that could be used, but that method is called on every kitchen action. So adding it there would make kitchen list spin up a chef-zero server.

So instead we recommend updating the with_provisioning_driver method (in a mutex) start up a chef-zero server if one doesn't exist yet:

def with_provisioning_driver(name, &block)
  instance.mutexes[self.class].synchronize do
    if @@chef_zero_server.nil?
      Chef::Config.local_mode = true
      Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(Dir.pwd)
      require 'chef/local_mode'
      Chef::LocalMode.setup_server_connectivity
      @@chef_zero_server = true
    end
  end

  chef_server = Cheffish.default_chef_server
  config[:machine_options][:convergence_options] = {:chef_server => chef_server}
  machine_spec = Chef::Provisioning.chef_managed_entry_store(chef_server).new_entry(:machine, name)
  url = URI::VsphereUrl.from_config(@config[:driver_options]).to_s
  driver = Chef::Provisioning.driver_for_url(url, config)
  action_handler = Chef::Provisioning::ActionHandler.new
  block.call(action_handler, driver, machine_spec)

end

Because this is missing some of the checks in Cheffish.honor_local_mode it will only work with recent versions of chef. If using the latest ChefDK, this should not be an issue.

When we get a new release of chef-zero out that has support for Chef::LocalMode.with_server_connectivity that can run without a block, we will be able to run Cheffish.honor_local_mode inside the Kitchen mutex and will shrink this code quite a lot. Then this vsphere driver would just need to ensure it is using the latest version of chef-zero.

machine_image not supported?

I tried to use machine_image, but received the error:
ChefProvisioningVsphere::VsphereDriver does not implement create_image

Any plans for implementing this, or some other resource to build vmware templates with?

Machine_batch provisioning issues

I apologize ahead of time if I don't word this right. I am attempting to use the machine_batch resource to create two servers. One is a SQL Server that I have 5 recipes written building it out using our standards here which has it's own unique machine_options that I don't want to share with the IIS Server such as the additional_disk_size_gb setting. The second machine is a simple iis server for now that just installs iis. Up until now I have used the with_machine_options boostrap_options settings and built out one server. I have used machine_batch in the past but with "like" servers 5 IIS servers for example.

There are some settings that could be shared among the sql and iis machines like domain join information so I was going to leave that up in the with_machine_options :bootstrap_options code, and remove unique settings.

Here is the code I have been attempting to use below the with_machine options. Does this look like something that is doable. I have attached the complete provisioning recipe & errors I'm getting. I've been looking this afternoon at other examples on chef's website & forums but the people seem to be using fog for aws so I'm not sure how much of that translates over.

machine_batch do
machine 'sql1' do
machine_options :bootstrap_options => {
additional_disk_size_gb: [20,10,5,4],
num_cpus: 4,
memory_mb: 16384,
}
run_list ["recipe[vsphere::sqlmp4]"]
end
machine 'web1' do
machine_options :bootstrap_options => {
num_cpus: 2,
memory_mb: 8096,
}
run_list ["recipe[vsphere::iis]"]

end
end

error1.txt

redactedrecipe.txt

plaintext passwords

What options are there for not providing the vsphere credentials in plan text ?

Linked Clone issue with Windows

Hello, I am provisioning afrom a Windows 2012 R2 server template, and have set use_linked_clone: false;. It appears that the newly provisoned machine remains a linked clone of the template I'm using even with the value set to false. Below is the section where I have the use_linked_clone setting.

with_machine_options :bootstrap_options => {
use_linked_clone: false,
num_cpus: 2,
memory_mb: 4096,

Error forwarding port: could not forward 8889 or 0 (This is for different VM templates)

Here is my recipe:
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end

require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: 'given',
insecure: true,
user: 'bla',
password: 'bla'

with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 2,
memory_mb: 4096,
network_name: ["wdc-hw-vms"],
datacenter: 'Horizon',
cluster: 'Horizon Suite',
resource_pool:"Horizon Suite/darshan-rp",
template_folder: 'Shared Templates/SaaS',
template_name:'ws-empty-vm-1.0.0.0-2623954',
customization_spec: {
ipsettings: {
dnsServerList: ['10.142.28.1','10.33.4.1','10.33.4.2']
},
:domain=> 'hs.trcint.com'
},

:ssh => {
:user => '***',
:password => '++++,
:paranoid => false,
}

},
:convergence_options => {
:ssl_verify_mode => :verify_none
}

machine "workspace1" do
run_list ['workspace_provisioning::default']
end

Here is the log file:

[2015-07-14T11:27:30-07:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /Users/dtumkursreeni/chef
One version per cookbook

[2015-07-14T11:27:30-07:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.4.0.rc.0
[2015-07-14T11:27:30-07:00] INFO: *** Chef 12.4.0.rc.0 ***
[2015-07-14T11:27:30-07:00] INFO: Chef-client pid: 17377
[2015-07-14T11:27:32-07:00] INFO: Run List is []
[2015-07-14T11:27:32-07:00] INFO: Run List expands to []
[2015-07-14T11:27:32-07:00] INFO: Starting Chef Run for dtumkursreeni
[2015-07-14T11:27:32-07:00] INFO: Running start handlers
[2015-07-14T11:27:32-07:00] INFO: Start handlers complete.
[2015-07-14T11:27:32-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
resolving cookbooks for run list: []
[2015-07-14T11:27:32-07:00] INFO: Loading cookbooks []
Synchronizing Cookbooks:
Compiling Cookbooks...
Recipe: @recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-14T11:27:32-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 1)
    (up to date)
    [2015-07-14T11:28:11-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-14T11:28:11-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:11-07:00] WARN: Chef::Resource::Machine is marked as providing DSL machine, but provides :machine was never called!
    [2015-07-14T11:28:11-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
    [2015-07-14T11:28:11-07:00] WARN: Class Chef::Resource::Machine does not declare 'provides :machine'.
    [2015-07-14T11:28:11-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:11-07:00] WARN: Node dtumkursreeni has an empty run list.
    Converging 2 resources

  • chef_gem[chef-provisioning-vsphere] action install[2015-07-14T11:28:11-07:00] INFO: Processing chef_gem[chef-provisioning-vsphere] action install (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 1)
    (up to date)

  • machine[workspace1] action converge[2015-07-14T11:28:11-07:00] INFO: Processing machine[workspace1] action converge (@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 77)
    [2015-07-14T11:28:11-07:00] WARN: Class Chef::Provider::Machine does not declare 'provides :machine'.
    [2015-07-14T11:28:11-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:11-07:00] WARN: Checking to see if {"driver_url"=>"vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true", "driver_version"=>"0.5.8", "server_id"=>"50201ab3-f522-bc7c-f902-872c29750042", "is_windows"=>false, "allocated_at"=>"2015-07-14 18:04:37 UTC", "ipaddress"=>"10.142.29.67"} has been created...
    establishing connection to 10.141.159.241
    [2015-07-14T11:28:15-07:00] WARN: returning existing machine
    [2015-07-14T11:28:15-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
    [2015-07-14T11:28:15-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:15-07:00] WARN: Chef::Resource::ChefNode is marked as providing DSL chef_node, but provides :chef_node was never called!
    [2015-07-14T11:28:15-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
    [2015-07-14T11:28:15-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
    [2015-07-14T11:28:15-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:15-07:00] INFO: Processing chef_node[workspace1] action create (basic_chef_client::block line 77)
    [2015-07-14T11:28:15-07:00] WARN: Class Chef::Provider::ChefNode does not declare 'provides :chef_node'.
    [2015-07-14T11:28:15-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    update node workspace1 at chefzero://localhost:8889
    update run_list from ["recipe[workspace_provisioning::default]"] to ["workspace_provisioning::default"]
    Power on VM [vm/workspace1][2015-07-14T11:28:18-07:00] INFO: Executing pwd on [email protected]
    [2015-07-14T11:28:32-07:00] INFO: Completed pwd on [email protected]: exit status 0
    IP address obtained: 10.142.29.67[2015-07-14T11:28:36-07:00] INFO: Executing pwd on [email protected]
    [2015-07-14T11:28:40-07:00] INFO: Completed pwd on [email protected]: exit status 0
    [2015-07-14T11:28:40-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
    [2015-07-14T11:28:40-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
    [2015-07-14T11:28:40-07:00] INFO: Processing chef_node[workspace1] action create (basic_chef_client::block line 57)
    [2015-07-14T11:28:40-07:00] WARN: Class Chef::Provider::ChefNode does not declare 'provides :chef_node'.
    [2015-07-14T11:28:40-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.

    • update node workspace1 at chefzero://localhost:8889
      update run_list from ["recipe[workspace_provisioning::default]"] to ["workspace_provisioning::default"][2015-07-14T11:29:09-07:00] WARN: Class Chef::Resource::ChefClient does not declare 'provides :chef_client'.
      [2015-07-14T11:29:09-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T11:29:09-07:00] WARN: Chef::Resource::ChefClient is marked as providing DSL chef_client, but provides :chef_client was never called!
      [2015-07-14T11:29:09-07:00] WARN: In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.
      [2015-07-14T11:29:09-07:00] WARN: Class Chef::Resource::ChefClient does not declare 'provides :chef_client'.
      [2015-07-14T11:29:09-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T11:29:09-07:00] WARN: Class Chef::Resource::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T11:29:09-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T11:29:09-07:00] INFO: Processing chef_client[workspace1] action create (basic_chef_client::block line 77)
      [2015-07-14T11:29:09-07:00] WARN: Class Chef::Provider::ChefClient does not declare 'provides :chef_client'.
      [2015-07-14T11:29:09-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      [2015-07-14T11:29:09-07:00] INFO: Processing chef_node[workspace1] action create (basic_chef_client::block line 143)
      [2015-07-14T11:29:09-07:00] WARN: Class Chef::Provider::ChefNode does not declare 'provides :chef_node'.
      [2015-07-14T11:29:09-07:00] WARN: This will no longer work in Chef 13: you must use 'provides' to provide DSL.
      update node workspace1 at chefzero://localhost:8889update run_list from ["recipe[workspace_provisioning::default]"] to ["workspace_provisioning::default"]
      RuntimeErro
      Error forwarding port: could not forward 8889 or 0
      Resource Declaration:

      In /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb

      77: return send(method_symbol, *args, &block)
      78: end

    Compiled Resource:

    Declared in /Users/dtumkursreeni/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/chef-12.4.0.rc.0/lib/chef/dsl/recipe.rb:77:in `method_missing'

    machine("workspace1") do
    action [:converge]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    chef_server {:chef_server_url=>"chefzero://localhost:8889", :options=>{:client_name=>"dtumkursreeni", :signing_key_filename=>"/Users/dtumkursreeni/.chef/dtumkursreeni.pem"}}
    driver "vsphere://10.141.159.241/sdk?use_ssl=true&insecure=true"
    machine_options {:bootstrap_options=>{:use_linked_clone=>true, :num_cpus=>2, :memory_mb=>4096, :network_name=>["wdc-hw-vms"], :datacenter=>"Horizon", :cluster=>"Horizon Suite", :resource_pool=>"Horizon Suite/darshan-rp", :template_folder=>"Shared Templates/SaaS", :template_name=>"ws-empty-vm-1.0.0.0-2623954", :customization_spec=>{:ipsettings=>{:dnsServerList=>["10.142.28.1", "10.33.4.1", "10.33.4.2"]}, :domain=>"hs.trcint.com"}, :ssh=>{:user=>"root", :password=>"ca$hc0w", :paranoid=>false}}}
    declared_type :machine
    cookbook_name "@recipe_files"
    recipe_name "/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb"
    run_list ["workspace_provisioning::default"]
    end

[2015-07-14T11:29:12-07:00] INFO: Running queued delayed notifications before re-raising exception

Running handlers:
[2015-07-14T11:29:12-07:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-14T11:29:12-07:00] ERROR: Exception handlers complete
[2015-07-14T11:29:12-07:00] FATAL: Stacktrace dumped to /Users/dtumkursreeni/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 102.230194 seconds
[2015-07-14T11:29:12-07:00] ERROR: machine[workspace1](@recipe_files::/Users/dtumkursreeni/chef/cookbooks/workspace_provisioning/recipes/vsphere_config.rb line 77) had an error: RuntimeError: Error forwarding port: could not forward 8889 or 0
[2015-07-14T11:29:12-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Document the minimum set of permissions that need to be granted to the vCenter user

We are currently trying to get chef-provisioning-vsphere running against our VMware infrastructure, but our admin has setup a user on vCenter for us with minimal permissions, and as such so far every attempt to create a vm with chef provisioning has thrown a permission denied error.

If anyone has already been through the pain of working out what the minimum set of permission are that needs granting to the chef provisioning user, would you mind documenting them in the README.md file or somewhere suitable please ?

current status

hi - I have tested it against my older vcenter and I got the following error. I use chefdk 0.6.x. How I may debug it? Are there any gem version requirements?

 Error executing action `converge` on resource 'machine[base-test-pemi]'
    ================================================================================

    RbVmomi::Fault
    --------------
    NotSupported: The operation is not supported on the object.


What does the error "missing required parameter name" mean

Copying the bug report from chef-boneyard/chef-provisioning#386


Hello,

I am attempting to use the vSphere driver for chef-provisioning. When I run chef-client, the first VM spins up and converges the recipe without issue. As soon as it gets to the second VM the chef run dies with the error:

    ====================================================================
Error executing action `converge` on resource 'machine[chef-2]'
    ====================================================================

RuntimeError
------------
missing required parameter name

Resource Declaration:
---------------------
# In /home/chef/.chef/local-mode-cache/cache/cookbooks/my_cookbook/recipes/provision.rb

 46:   machine "chef-#{num}" do
 47:     recipe 'my_cookbook::default'
 48:     attribute %w[foo bar] = baz
 48:   end
 49: end

My provisioning recipe (outside of my vSphere configuration) is simply:

num_servers = 3

1.upto(num_servers) do |num|
  machine "chef-#{num}" do
    recipe 'my_cookbook::default'
    attribute %w[foo bar] = baz
  end
end

This is confusing because the error has the machine name in it, and there is literally no difference between machine one and machine ten.

Changing the above lines to the following allows the VM to spin up without issue:

#1.upto(num_cassandra_servers) do |num|
  machine "chef-2" do
    recipe 'my_cookbook::default'
    attribute %[foo bar] = baz
  end
#end

The same cookbook runs fine in test kitchen minus the provisioning bit.

Any help is greatly appreciated.

Thanks!

EDIT:

To add further to my confusion, if I create each machine individually by editing the machine name, e.g. replace "chef-#{num}" with "chef-1", "chef-2", "chef-3", the modify the recipe to use the loop, running chef again on the already running vms completes without issue.

Chef-Zero Create Node Error

Hello,

I am attempting to provision a machine with chef-zero on my workstation and having an issue which appears to be the node JSON not being created. I have used the Vagrant driver before and never had this issue, it created the JSON during the provision process. I believe thats the whole point, the node shouldn't exist yet. The error I am getting is this:

undefined method `uuid' for nil:NilClass

When running with debug level I get a bit more information which leads me to believe the above statement:

--- RESPONSE (404) ---
{
  "error": [
    "Object not found: chefzero://localhost:8889/nodes/MY-NODE"
  ]
}

I hope this is just something silly on my end. Like I said before, I've used the Vagrant driver before so chef-zero should be configured correctly.

In the logs it seems as if I have all of my vSphere settings correct, its connecting to the ESXi host and finding the datastore, template, network, etc. that I am specifying. Any help would be greatly appreciated.

destroying VM works, but throws error

I've been hacking around trying to figure out how to make a generic provisioning system out of this, and I've made a lot of progress. Running a clean gem pull from today using chef_gem, I'm creating a series of machines like:
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/RS-Provisioning/recipes/default.rb

 85:   machine "microtest#{count}" do
 86:     my_ip[count] = {
 87:       bootstrap_options: {
 88:         customization_spec: {
 89:           ipsettings: {
 90:             ip: "10.132.21.#{count}"
 91:           }
 92:         }
 93:       }
 94:     }
 95:     new_options[count] = Chef::Mixin::DeepMerge.deep_merge(default_options,my_ip[count])
 96:     name "microtest#{count}"
 97:     run_list ['RS-DCS-Base']
 98:     machine_options new_options[count]
 99:     action :ready
100:   end
101: end

to just quickly spin 5 machines. It works fine. I then replace ready with destroy. The first VM powers down and is deleted by vcenter as expected, but throws a:

Net::HTTPServerException
------------------------
chef_client[microtest105](basic_chef_client::block line 26) had an error: Net::HTTPServerException: 403 "Forbidden"

First part of the trace looks like:

Generated at 2015-08-12 16:19:17 -0400
Net::HTTPServerException: machine[microtest105] (RS-Provisioning::default line 85) had an error: Net::HTTPServerException: chef_client[microtest105] (basic_chef_client::block line 26) had an error: Net::HTTPServerException: 403 "Forbidden"
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
/opt/chef/embedded/apps/chef/lib/chef/http.rb:145:in `request'
/opt/chef/embedded/apps/chef/lib/chef/http.rb:110:in `get'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/actor_provider_base.rb:117:in `load_current_resource'
/opt/chef/embedded/apps/chef/lib/chef/provider.rb:113:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/resource.rb:562:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:49:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `each'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block in converge'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:80:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/basic_chef_client.rb:69:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/basic_chef_client.rb:133:in `call'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/basic_chef_client.rb:133:in `with_chef_config'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/basic_chef_client.rb:68:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/cheffish-1.2.1/lib/cheffish/basic_chef_client.rb:109:in `converge_block'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.3.0/lib/chef/provisioning.rb:12:in `inline_resource'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.3.0/lib/chef/provisioning/convergence_strategy/no_converge.rb:21:in `cleanup_convergence'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vsphere-0.7.1/lib/chef/provisioning/vsphere_driver/driver.rb:392:in `destroy_machine'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.3.0/lib/chef/provider/machine.rb:95:in `block in <class:Machine>'
/opt/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in `instance_eval'
/opt/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in `recipe_eval_with_update_check'
/opt/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:in `block in action'
/opt/chef/embedded/apps/chef/lib/chef/provider.rb:130:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/resource.rb:562:in `run_action'

Each chef-client run then deletes one more, as expected, then 403's. The 403 return is instantaneous, meanwhile the VCenter delete obviously takes a few seconds (10-15ish).

I'll try to dig in but I've run out of time on this for the moment.

Thanks for the good work; I'm really glad I ran across this gem.

Wes

RuntimeError while serializing gateway (xsd:string)

Short version:
Has anyone recently be able to use bootstrapping option [:customization_spec][:ipsettings][:gateway]?

Long version:
I'm a Chef, chef-provisioning-vsphere and Ruby newbie. It is quite likely that I've fat fingered something somewhere. But given I've successfully been able to use the other [:customization_spec][:ipsettings] bootstrapping options, I figured I'd check with the experts. :-)


****** My command line **********************


chef-client -z test1.rb


****** My test1.rb source *********************


require 'chef/provisioning'
require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: '10.65.42.3',
insecure: true,
user: 'some-user1',
password: 'some-pw1'

with_machine_options :bootstrap_options => {
datacenter: "SAI Lab",
network_name: "SAI Network 48 - SDN",
resource_pool: "10.65.41.2",
template_name: "GP-small-u14---Mark",
num_cpus: 2,
memory_mb: 4096,
customization_spec: {
ipsettings: {
ip: "10.65.48.28",
subnetMask: "255.255.255.0",
gateway: "10.65.48.1",
dnsServerList: ["10.6.16.43", "10.6.17.43"]
},
},
:ssh => {
:user => 'some-user2',
:password => 'some-pw2',
:paranoid => false,
}
}

machine 'OPnode8-provisioned' do
recipe 'mysql'
end


****** My error *********************************


Converging 1 resources Recipe: @recipe_files::/Users/mschnell/chef-repo/test1.rb - machine[OPnode8-provisioned] action converge[2015-07-15T13:37:06-04:00] INFO: Processing machine[OPnode8-provisioned] action converge (@recipe_files::/Users/mschnell/chef-repo/test1.rb line 32) [2015-07-15T13:37:06-04:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/OPnode8-provisioned - creating machine OPnode8-provisioned on vsphere://10.65.42.3/sdk?use_ssl=true&insecure=true - datacenter: "SAI Lab" - network_name: "SAI Network 48 - SDN" - resource_pool: "10.65.41.2" - template_name: "GP-small-u14---Mark" - num_cpus: 2 - memory_mb: 4096 - customization_spec: {:ipsettings=>{:ip=>"10.65.48.28", :subnetMask=>"255.255.255.0", :gateway=>"10.65.48.1", :dnsServerList=>["10.6.16.43"]}} - ssh: {:user=>"some-user2", :password=>"some-pw2", :paranoid=>false}establishing connection to 10.65.42.3 - finding networks... - network: SAI Network 48 - SDN is a Network - changing template nic for SAI Network 48 - SDN - customizing OPnode8-provisioned with static IP 10.65.48.28 RuntimeError while serializing gateway (xsd:string): "10.65.48.1" RuntimeError while serializing adapter (CustomizationIPSettings): CustomizationIPSettings( dnsServerList: ["10.6.16.43"], gateway: "10.65.48.1", ip: CustomizationFixedIp( ipAddress: "10.65.48.28" ), subnetMask: "255.255.255.0" ) RuntimeError while serializing nicSettingMap (CustomizationAdapterMapping): CustomizationAdapterMapping( adapter: CustomizationIPSettings( dnsServerList: ["10.6.16.43"], gateway: "10.65.48.1", ip: CustomizationFixedIp( ipAddress: "10.65.48.28" ), subnetMask: "255.255.255.0" ) )

****** Extra notes ******************************


Given that :gateway is a single address, I copied the syntax that I had successfully used for the :subnetMask & :ip options...
ip: "10.65.48.28",
subnetMask: "255.255.255.0",

Just for fun, I tweaked the gateway definition line...

  • from: gateway: "10.65.48.1",
  • to gateway: ["10.65.48.1"],
    ...and I got my VM to instantiate as desired.

So it would seem that the :gateway option seems to use the "list" syntax of the :dnsServerList...

  •   dnsServerList: ["10.6.16.43", "10.6.17.43"]
    

****** Bottom line ******************************


I have a work around for my :gateway error, but it seems like the :gateway syntax is using a "list" instead of a "single entry". Is this the intent, or is this an error?

Cheers... Mark

RbVmomi::Fault: InvalidArgument: A specified parameter was not correct. spec.identity.hostName

Hello,

I am trying to test out provisioning using vCenter. It's probably something I'm doing wrong, but I thought I'd see if someone can help. I am using chef-zero.
I am able to provision a VM but customization spec (P address, Gateway, dnsserverlist and etc) not applied/set on the VM and getting below error.

Error message:

RbVmomi::Fault: InvalidArgument: A specified parameter was not correct.
spec.identity.hostName

Recipe :

with_machine_options :bootstrap_options => {
num_cpus: 2,
memory_mb: 4096,
network_name: ["VM Network"],
datacenter: 'IB',
resource_pool: '172.26.1.4',
template_name: 'redhat',
hostname: "chef.demo.com",
customization_spec: {
ipsettings: {
ip: '172.26.1.101',
dnsServerList: ['172.26.1.2'],
subnetMask: '255.255.255.0',
gateway: ['172.26.1.1']
},
:domain => 'demo.com'
},
:ssh => {
:user => 'root',
:password => 'password',
:paranoid => false,
}
}

Stack trace :
Generated at 2015-06-16 22:06:50 -0700 RbVmomi::Fault: machine[chef_server] (infoblox::chef_provision line 41) had an error: RbVmomi::Fault: InvalidArgument: A specified parameter was not correct. spec.identity.hostName c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Task.rb:11:inwait_for_completion'
c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb:173:in do_vm_clone' c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:494:inclone_vm'
c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:177:in find_or_create_vm' c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-vsphere-0.5.7/lib/chef/provisioning/vsphere_driver/driver.rb:135:inallocate_machine'
c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.2.0/lib/chef/provider/machine.rb:30:in block in <class:Machine>' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:ininstance_eval'
c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in recipe_eval_with_update_check' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:inblock in action'
c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.2.0/lib/chef/provider/machine.rb:37:in block in <class:Machine>' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:ininstance_eval'
c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in recipe_eval_with_update_check' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:inblock in action'
c:/opscode/chef/embedded/lib/ruby/gems/2.0.0/gems/chef-provisioning-1.2.0/lib/chef/provider/machine.rb:55:in block in <class:Machine>' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:ininstance_eval'
c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:60:in recipe_eval_with_update_check' c:/opscode/chef/embedded/apps/chef/lib/chef/provider/lwrp_base.rb:45:inblock in action'
c:/opscode/chef/embedded/apps/chef/lib/chef/provider.rb:130:in run_action' c:/opscode/chef/embedded/apps/chef/lib/chef/resource.rb:562:inrun_action'
c:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:49:in run_action' c:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:inblock (2 levels) in converge'
c:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:in each' c:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:inblock in converge'
c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:in block in execute_each_resource' c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:incall'
c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block' c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:instep'
c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in iterate' c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index'
c:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:in execute_each_resource' c:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:80:inconverge'
c:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:339:in block in converge' c:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:334:incatch'
c:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:334:in converge' c:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:353:inconverge_and_save'
c:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:457:in run' c:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:253:inrun_with_graceful_exit_option'
c:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:230:in block in run_chef_client' c:/opscode/chef/embedded/apps/chef/lib/chef/local_mode.rb:39:inwith_server_connectivity'
c:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:213:in run_chef_client' c:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:402:inblock in interval_run_chef_client'
c:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:392:in loop' c:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:392:ininterval_run_chef_client'
c:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:382:in run_application' c:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:60:inrun'
c:/opscode/chef/embedded/apps/chef/bin/chef-client:26:in <top (required)>' c:/opscode/chef/bin/chef-client:63:inload'
c:/opscode/chef/bin/chef-client:63:in <main>'

create_ssh_transport should use hash instead of Cheffish::MergedConfig

When creating a new VM and it's in a ready state, chef-provisioning tries to create a transport and it fails with the following error:

    NoMethodError
    -------------
    Unexpected method delete for MergedConfig with arguments [:remote_forwards]

The relevant lines from chef stacktrace are:

NoMethodError: machine[supermarket] (cespi_clusters::management line 8) had an error: NoMethodError: Unexpected method delete for MergedConfig with arguments [:remote_forwards]
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/cheffish-2.0.2/lib/cheffish/merged_config.rb:50:in `method_missing'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provisioning/transport/ssh.rb:45:in `initialize'
/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:662:in `new'
/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:662:in `create_ssh_transport'/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:638:in `transport_for'
/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:612:in `wait_for_transport'
/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:284:in `transport_respond?'
/home/car/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.3/lib/chef/provisioning/vsphere_driver/driver.rb:209:in `ready_machine'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-1.6.0/lib/chef/provider/machine.rb:39:in `block in <class:Machine>'
(eval):2:in `block in action_ready'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider.rb:360:in `instance_eval'

Following the code, I think there is a problem at lib/chef/provisioning/vsphere_driver/driver.rb#L665
The problem seems to be that the options is a Cheffish::MergedConfig object and it doesn't implements a #delete as can be seen in chef provisioning gem implementation

So, I propose to change

    def create_ssh_transport(host, options)
      require 'chef/provisioning/transport/ssh'
      ssh_user = options[:user]
      Chef::Provisioning::Transport::SSH.new(
        host,
        ssh_user,
        options,
        @config[:machine_options][:sudo] ? {:prefix => 'sudo '} : {},
        config
      )
    end

With

    def create_ssh_transport(host, options)
      require 'chef/provisioning/transport/ssh'
      ssh_user = options[:user]
      Chef::Provisioning::Transport::SSH.new(
        host,
        ssh_user,
        options.to_hash,
        @config[:machine_options][:sudo] ? {:prefix => 'sudo '} : {},
        config
      )
    end

VM is provisioned as linked clone when set to false

Hello, I provisioned a VM from a recipe that had use_linked_clone: 'false', set within the recipe. I then did a VM/Storage Vmotion to our development ESXi hosts which do not have access to the storage of the template we use. The cloned VM wouldn't power on and I began to investigate the issue. I looked at the descriptor file for the vmdk and it has a ParentFilenameHint setting with the parent VMs VMDK referenced.
descripterfile

It appears to be happening regardless if I set use_linked_clone to true or false.

with_machine_options :bootstrap_options => {
use_linked_clone: 'False',
num_cpus: 2,
memory_mb: 8096,

As you can see in the screenshot above it is referencing W2K12STD2 which is the name of the template we clone from and not the name of the VM itself.

Handle setting MAC address somehow?

Any recommendations for setting the MAC address for new machines? knife vsphere has --cspec is there a clean way to use that with chef provisioning?

Static IP and machine batch

Hi, I am new to chef provisioning-vsphere, I have been able to make simple recipes build, the problem I am having is I need to use static ip's ( i know ... so last century ) but when I want to build 4 servers with 4 different IP's how do I update the machine options once in the machine batch ? to change the IP based on the machine ? Thanks for any help !
Robert

Cheffish goes crazy on machine_options

Situation: We have made our provisioning very dynamic in order to define our multiple environments in the json environment files. We have an array of servers that the loop in the code below goes through to call the machine resource. The code snippet below is just the pertinent part of our provisioning recipe, there is not much else other than the definitions of the variables and such. The issue we have is that it will machine :converge 6 linux boxes, then the first windows box the log spits out several thousand lines of:

creating machine wnsql1 on vsphere://???.net/sdk?use_ssl=true&insecure=true
    -   use_linked_clone: false
    -   customization_spec: #<Cheffish::MergedConfig:0x000000085c0f28 @configs=[{:org_name=>
*** THOUSANDS OF LINES OF REPEAT CODE, THE MATRIX ***

As the code shows, we are just passing in a hash, where it is being converted into a Cheffish::MergedConfig I don't know, but it seems to be the merger of the same config hundreds of times. I'm not sure if it's just the fact that it's number 7, or if it's windows, or what....Are we just doing something wrong and not understanding ruby/chef-provisioning?

Provisioning Server Chef Versions

chef (12.5.1)
chef-config (12.5.1)
chef-dk (0.10.0)
chef-provisioning (1.5.1, 1.5.0)
chef-provisioning-aws (1.6.1)
chef-provisioning-azure (0.4.0)
chef-provisioning-fog (0.15.0)
chef-provisioning-vagrant (0.10.0)
chef-provisioning-vsphere (0.8.3)
chef-vault (2.6.1)
chef-zero (4.3.2, 1.5.6)
cheffish (1.6.0)

Provisioning Recipe

    cluster[:servers].each do |server|
        bootstrap_options = {
            use_linked_clone: false,
            customization_spec: {
                :org_name => '???',
                :time_zone => 'America/New_York',
                :win_time_zone => 35,
                :product_id => windows_product[:id],
                :ipsettings => {}
            },
            :ssh => {
                :paranoid => false
            }
        }

        bootstrap_options[:vm_folder] = cluster[:vm_folder] if cluster[:vm_folder]
        bootstrap_options[:datacenter] = cluster[:datacenter] if cluster[:datacenter]
        bootstrap_options[:datastore] = cluster[:datastore] if cluster[:datastore]
        bootstrap_options[:host] = cluster[:host] if cluster[:host]
        bootstrap_options[:resource_pool] = cluster[:resource_pool] if cluster[:resource_pool]
        bootstrap_options[:template_folder] = cluster[:template_folder] if cluster[:template_folder]

        bootstrap_options[:template_name] = server[:template] if server[:template]
        bootstrap_options[:network_name] = server[:networks] if server[:networks]
        bootstrap_options[:num_cpus] = server[:cpu] if server[:cpu]
        bootstrap_options[:memory_mb] = server[:ram] if server[:ram]

        bootstrap_options[:customization_spec][:domain] = cluster[:domain] || 'local'
        bootstrap_options[:customization_spec][:domainAdmin] = domain_secrets[:join_username] if domain_secrets[:join_username]
        bootstrap_options[:customization_spec][:domainAdminPassword] = domain_secrets[:join_password] if domain_secrets[:join_password]
        bootstrap_options[:customization_spec][:hostname] = server[:hostname] if server[:hostname]
        bootstrap_options[:customization_spec][:ipsettings][:ip] = server[:ip] if server[:ip]
        bootstrap_options[:customization_spec][:ipsettings][:subnetMask] = cluster[:subnet_mask] if cluster[:subnet_mask]
        bootstrap_options[:customization_spec][:ipsettings][:gateway] = server[:gateways] if server[:gateways]
        bootstrap_options[:customization_spec][:ipsettings][:dnsServerList] = cluster[:dns_servers] if cluster[:dns_servers]

        bootstrap_options[:ssh][:user] = server[:transport_mode] == 'ssh' ? ssh_secrets[:username] : winrm_secrets[:username]
        bootstrap_options[:ssh][:password] = server[:transport_mode] == 'ssh' ? ssh_secrets[:password] : winrm_secrets[:password]

        data_bag_secret_location = ::File.join('etc', 'chef', 'encrypted_data_bag_secret') if server[:transport_mode] == 'ssh'
        data_bag_secret_location = ::File.join('C:', 'chef', 'encrypted_data_bag_secret') if server[:transport_mode] == 'winrm'

        machine server[:hostname] do
            run_list server[:run_list]
            chef_environment node.chef_environment
            files data_bag_secret_location => '/etc/chef/secret'
            machine_options :bootstrap_options => bootstrap_options,
                :convergence_options => {
                    ssl_verify_mode: :verify_none
                },
                :start_timeout => 2000,
                :create_timeout => 2000,
                :ready_timeout => 2000
        end
    end

Attempting to use multiple additional_disk_size_gb

example1
Hello, I am needing to provision a server with multiple datastores to use with mountpoints for SQL Server. I have a datastore specificed, and multiple additional_dsk_size_gb: statements in the recipe. However It is just adding one additional datastore. Below is a sample of the recipe.

Thanks!

with_machine_options :bootstrap_options => {
use_linked_clone: true,
num_cpus: 2,
memory_mb: 4096,
network_name: ["VLAN18"],
datacenter: 'datacenter name,
datastore: 'Prod0_Tier1_3PAR01',
additional_disk_size_gb: 5,
additional_disk_size_gb: 5,
additional_disk_size_gb: 5,
additional_disk_size_gb: 5,
resource_pool: 'Dev_Cluster_01',

Machine resource doesnt seem to work as expected in machine_batch

I tried converging multiple machine resources in a machine_batch but it did not work as expected. I don't know if this is an issue with this driver or with the machine_batch resource, but it created 3 VMs, and then converged the same vm 3 times as 3 different nodes. Likewise, when destroying in machine_batch, all 3 nodes were unregistered from the chef server, but only one of the VMs was actually destroyed.

I was running from Chef-zero using Chef-client 12.3.0 on Windows 10.

need to specify vmname

Hi, Is there a way to pass a vm name to the clone process when using the test kitchen driver ?
thanks !
rob

Virtual Machines provisioned using DHCP result in WinRM timeouts

We recently updated to driver 0.8.1 on two of our workstations and we started to notice anytime we use DHCP to provision new servers it results in a WinRM timeout. The servers provisioned actually pull an IP from DHCP but for some reason it seems to attempt to use the 169 during bootstrapping over WinRM.. If we go in and add a static IP the servers provision correctly. I've tried multiple recipes and it seems to fail on all of them now. The examples below are of a machine_batch provision recipe but the same thing happens when provisioning just a one machine resource.

dhcp

ipobtained

dhcppartofrecipe

winrmfailure2
winrmfailureendofps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.