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