Get node id

dennyreiter

Member
Jan 23, 2023
5
0
6
Is there an easy way to determine what the node id is? I'm working on an Ansible script where a template is created to then create a VM. Since I have multiple nodes, I would like to create the template with a unique vmid, for instance the template on node 1 would be 8001, on node 4 would be 8004, etc. I was hoping for something by running
Code:
pvesm
to retrieve the value. The closest I've found so far is a list from
Code:
pvesh get /cluster/status

Thanks
 
Code:
root@pve-1:~# pvesh get /cluster/status --output-format json|jq --arg HOST $HOSTNAME '.[]|select(.name == $HOST)|.nodeid'
1

PS I have doubts about the entire approach of trying to tie semi-random numerical IDs , but if thats what you'd like to do - do it.

Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: LnxBil