Bulk operations - Ability to perform actions on multiple nodes
#2,404 opened on Jan 22, 2022
Description
What are you trying to do? Currently all commands use instance name to perform operations. This makes operations on multiple instances difficult and requires individual commands/action on each instance. For example: if I have 3 VMs for apps, 2 vms for db, and I want to run a command on just db nodes, I would have to run two commands. Or If I have to reboot app servers, thats 3 commands.
What's your proposed solution? One option is to allow adding tags/lables to hosts. While launching we can add add these tags in commands line.
multipass launch --name app-server1 -m2g -c1 -d10g --tags group=app-server
multipass launch --name app-server2 -m2g -c1 -d10g --tags group=app-server
multipass launch --name app-server3 -m2g -c1 -d10g --tags group=app-server
Then for any operations we can specify the tag, instead of instance name.
multipass stop --tags group=app-server
multipass exec --tags group-app-server exec systemctl daemon-reload
multipass start --tags grou=app-server
Additionally, if we can expose these tags to the VM environment (file, metadata, etc.), we can make use of them in config management tool like Chef/Puppet/Script/Cloud-init, etc.
Additional context I made a small utility for multi-node microk8s cluster yogendra/mnmk8s (terrible name, i know), that does something similar, in absence of this feature.