Get node id

dennyreiter

New Member
Jan 23, 2023
4
0
1
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
I’ve run into this before with Proxmox too. If you’re looking to pull the node ID, pvesh get /cluster/status should give you the node info, and from there, you can figure out which node is which. As for using a template with a unique vmid per node, you can definitely automate it with something like Ansible.
If you're still having trouble and want an easy way to check if everything's legit, I've found that using something like idanalyzer.com can help verify data authenticity when you're automating things, especially when you’re managing multiple nodes.
 
Last edited:

About

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!