Command line qm set --tags

boboinmo

Member
Jun 10, 2022
7
0
6
I want to add a tag to an already tagged server, I don't want to remove the tags that exist. Is there a way to do that? I tried qm set --tags and it overwrote all my tags.
Also how what about multiple tags
 
Last edited:
Here is something that might work for you and is easy to expand:
Code:
export vmid=$1
newtags=$2

mycluster=$(pvesh get /cluster/resources --output json)

myvm=$(jq -er '.[]|select(.id == "qemu/"+env.vmid)' <<< $mycluster)
mynode=$(jq -r '.node' <<< $myvm)
current_tags=$(jq -r '.tags // empty' <<< $myvm)
pvesh set /nodes/$mynode/qemu/$vmid/config --tags "$current_tags $newtags"

bash addtag.sh 103 tag5
update VM 103: -tags tag1;tag2;tag3;tag4 tag5


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

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!