Customize my virtual machine name, but do not use the vm name for the operating system name
I follow the link below to configure,i can successfully customize the VM name
https://vmguru.com/2020/03/create-custom-names-with-vrealize-automation-8/
but,the operating system name is follow vm name.If the VM name does not conform to the operating system name specification, my VM cannot be created.
how can i do
You could use CloudInit
cloudConfig: |
#cloud-config
set_hostname: '${self.name}'
But it requires you to have installed CloudInit (Linux)/CloudBase-Init (Windows) within the template
For Windows, I highly recommend you to look at the code from v12n.io, as it was the first I could get to work.
https://github.com/v12n-io/packer/blob/main/script/windows/90-cloudinit.ps1
So that is up to you. You can either use vSphere Customization Specs (where you set the property to set the name of the GuestOS to match the VM name) or you can use cloud init and programmically set the VM name/IP. There are lots of blogs on cloud init. My first hit was
Carl L.
How to set the name of guestOS in yaml.
I'm not very familiar with vra8,Can you print the code?
Thank you very much.
You could use CloudInit
cloudConfig: |
#cloud-config
set_hostname: '${self.name}'
But it requires you to have installed CloudInit (Linux)/CloudBase-Init (Windows) within the template
For Windows, I highly recommend you to look at the code from v12n.io, as it was the first I could get to work.
https://github.com/v12n-io/packer/blob/main/script/windows/90-cloudinit.ps1
I you want to use cloudconfig, you'll also need to prepare your template to work with it.