Hostname in Cloud-init user data

No, its not possible today. You will need to wrap it around with something. What the wrapper is will depend on how you create your VMs.
You can also file an enhancement request as described here:

Blockbridge : Ultra low latency all-NVME shared storage for Proxmox -

So I'll have to create a user-data snippet per VM. Would be useful to do this with the PVE API, as others think too:
Proxmox default user config would look like this:
qm cloudinit dump 9000 user
hostname: tmpl
manage_etc_hosts: true
fqdn: tmpl
  expire: False
  - default
package_upgrade: true

Hostname will be dynamic whenever new VM will be created with certain name specified:
qm cloudinit dump 100 user
hostname: foo
fqdn: foo

So you can use cicustom with vendor custom file (instead of user custom file) and keep user custom file for Proxmox:
# cat 9000.conf
cicustom: vendor=local:snippets/vendor.yaml,network=local:snippets/network.yaml

Although the new problem would with users directive in vendor file. Proxmox adds users directive when ciuser is either no set or set to anything other root. As per cloud-init docs, users and groups module frequency is once per instance so if vendor file has users directive too - vendor users directive won't be executed.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!