knife-vsphere icon indicating copy to clipboard operation
knife-vsphere copied to clipboard

Hostname is not assigned to the VM

Open BhargaviAllada opened this issue 5 years ago • 3 comments

Versions:

  • Version of knife-vsphere: 2.0.1
  • Version of chef: 13.6.4

Platform Details

  • Version of vSphere: Version 6.5.0.10000 Build 7119157
  • Version of ESXi: 6.5.0

Issue:

Whenever I am cloning a Windows VM using the template, The VM takes template name as its Computer Name (DNS Name) and due to this I am unable to join the VM to the domain.

Command I use:

knife vsphere vm clone testb2 --cips DHCP --template 'TEST_CHEF_TMPT' --datastore ******** --host *********** --disable-customization true --start

Output:

Cloning template TEST_CHEF_TMPT to new VM testb2 Finished creating virtual machine testb2 Powered on virtual machine testb2

Regards, Bhargavi.

BhargaviAllada avatar Feb 07 '19 06:02 BhargaviAllada

Hi, to set the vm's hostname, we need to run the customization steps. --disable-customization true skips over that. Does it work if you remove that?

swalberg avatar Feb 07 '19 12:02 swalberg

Hi Sean,

Yes! it is working fine when I pass the --cspec (customization specifications) in the Clone command. But it is not working with --disable-customization true (without the --cspec). So, is it mandate to pass --cspec for the hostname to be reflected on the VM? Or is there any explicit knife vsphere command to change the hostname of the VM post cloning without the customization specifications ?

Regards, Bhargavi.

BhargaviAllada avatar Feb 07 '19 12:02 BhargaviAllada

Hi, there are a handful of customization options at https://github.com/chef/knife-vsphere#customization-options, in particular you're looking for --chostname and possibly --cdomain.

Under the hood the settings specified in the cspec are mashed up with what's passed on the command line, so it's not one or the other. For Windows, we configure the domain joining stuff in a server side cspec and then customize everything else on the command line.

swalberg avatar Feb 07 '19 13:02 swalberg