Get Proxmox VM name into a VM

HubertMaier

Member
Sep 30, 2021
9
1
8
38
Hi,

I would like to set the host name of a VM automatically to the name the VM have in Proxmox. ("Options" -> "Name"). Please correct me if I'm wrong, but Cloud-Init would only help on the first boot and don't have a option for host name.

My question/idea is to run a script inside the VM on every startup to set the host name, but is it possible over the Qemu guest agent or a different thing to request the own name of the VM from Proxmox? Or any other idea for doing this?

Thanks