nsidc / vagrant-vsphere

VMware vSphere provider for Vagrant
Other
608 stars 166 forks source link

Network Adapter disabled when provisioning VM #156

Closed karnold closed 8 years ago

karnold commented 8 years ago

Upon provisioning a new server, the vlan and mac address are set correctly, but the NIC is disabled and I have to enable it through vSphere Client before the network works

Vagrant.configure(2) do |config|

  config.vm.box = 'vsphere'
  config.vm.box_url = '../boxes/vsphere.box'
  config.vm.hostname = @settings['hostname']
  config.vm.define @settings['hostname'] do |d|
  end

  # Networking
  config.vm.network 'private_network', ip: @settings['ip_address']

  # vSphere settings
  config.vm.provider :vsphere do |vsphere|

    # Basic vSphere Cluster and VM settings
    vsphere.name = @settings['hostname']
    vsphere.host = @settings['vsphere_host']
    vsphere.compute_resource_name = @settings['compute_resource_name']
    vsphere.template_name = @settings['template_name']
    vsphere.vm_base_path = @settings['vm_base_path']
    vsphere.data_center_name = @settings['data_center_name']

    # vSphere Credentials
    vsphere.user = @credentials['vsphere_user']
    vsphere.password = @credentials['vsphere_password'] 
    vsphere.insecure = true

    # Hardware specifications
    vsphere.memory_mb = @settings['memory']
    vsphere.cpu_count = @settings['cpu_count']
    vsphere.vlan = @settings['vlan']
    vsphere.mac = @settings['mac']
    vsphere.data_store_name = @settings['data_store_name']
    vsphere.customization_spec_name = @settings['customization_spec_name']

    # Misc
    #vsphere.custom_attribute('timestamp', Time.now.to_s)
  end
billclark91 commented 8 years ago

+1 experiencing this issue. Although I'm not specifying vsphere.vlan, mac or data_store_name.

billclark91 commented 8 years ago

@karnold Give these instructions a try. I was able to get VM provisioning to work following these steps.

0) Convert your template to VM and power on. 1) Uninstall old vmware-tools 2) Uninstall any open-vm-tools packages 3) Install open-vm-tools and open-vm-tools-deploypkg 4) Make sure there are no startup errors waiting for user input. If so, resolve them. 5) Shutdown VM and convert to template 6) From vSphere/vCenter UI, make sure you can: A) Deploy VM from template WITHOUT customization spec B) Deploy VM from template WITH customization spec If network adapter is connected in A but disconnected in B, your open-vm-tools-debloypkg is missing or corrupt. Start over from top. 7) Launch your VM from Vangrant+vsphere WITHOUT customization spec and ensure network adapter is connected. If not, verify your Vagrantfile is using correct VM template. 8) Launch your VM from Vagrant+vsphere WITH customization spec and ensure network adapter is connected. If you're having issues on this step, enable open-vm-tools logging on template then re-launch VM using Vagrant+vpshere. http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007873 (although it's written for old vmware-tools, it works under open-vm-tools).

karnold commented 8 years ago

Looks like that did the trick. I did not have open-vm-tools-deploypkg installed, only open-vm-tools. Thanks for your help!!!