Hostname set to virtual-machine instance ?

Akante

Member
Oct 6, 2020
1
0
21
34
Hello proxmoxers :)

I am running several instances everyday with help of latest proxmox.
I would like to automate it now so that i can configure hostnames when cloning from template.
Is that even achievable ? I heard that Options->name param is responsible for hostname but changing it does not affect anything.

EDIT:

Maybe i've written this wrong how can i change hostname of my machine with the help of API or cloud_image automatically so that not to change config inside disk image itself since this is not automate.


Regards
 
Last edited:
Hey,

the hostname for linux VMs is specified in /etc/hostname, how you set the hostname depends on what OS you're running in the VM, therefore it's a little complicated provide a general interface to set it for all kinds of OS that may run in the VM. If you run linux based guests changing /etc/hostname is enough.
 
hi. But is there a way to somehow get the VM name having the guest agent running? then I could automate replacing the hostname on the VM in the /etc/hostname.
 
i was thinking that maybe the running agent could set an env variable with the VM name (on the VM itself), so I don't need to reach the host API :)
 
if the VM runs the agent anyway, wouldn't it be convenient to have a VM name as env variable?