VMware Cloud Community
Jfallen
Contributor
Contributor
Jump to solution

vra8 Customize my virtual machine name question

vra8 Customize my virtual machine name

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

Reply
0 Kudos
1 Solution

Accepted Solutions
A_Mikkelsen
Expert
Expert
Jump to solution

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 

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points. Regards A. Mikkelsen

View solution in original post

Reply
0 Kudos
4 Replies
carl1
Expert
Expert
Jump to solution

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

https://vmwarelab.org/2020/02/14/vsphere-customization-with-cloud-init-while-using-vrealize-automati...

Carl L.

Reply
0 Kudos
Jfallen
Contributor
Contributor
Jump to solution

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.

Reply
0 Kudos
A_Mikkelsen
Expert
Expert
Jump to solution

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 

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points. Regards A. Mikkelsen
Reply
0 Kudos
jimmyvandermast
Hot Shot
Hot Shot
Jump to solution

I you want to use cloudconfig, you'll also need to prepare your template to work with it.

Reply
0 Kudos