gcloud-knife is a tool to run commands on multiple GCP instances concurrently using ssh.
It can also be used to initially list the instances to ensure that the filter is working correctly before executing commands on the VMs.
dnf copr enable brandfbb/gcloud-knife
dnf install gcloud-knife
go build -v -o gcloud-knife
# gcloud-knife
Usage: gcloud-knife [-h] [-c value] [-f value] [-p value] [-t value] [-u value] [parameters ...]
-c, --command=value
command to run, if empty will print the list of hosts
-f, --filter=value
filter
-h, --help display this help
-p, --project=value
project
-t, --port=value optional port, default: 22
-u, --user=value optional user, otherwise will read from local configuration
Execute a command in multiple VMs filtering by their name
gcloud-knife -p my-gcp-project -f name:*webservers.mydomain.com -c "df -H | grep nfs"
List VMs that match a given filter
gcloud-knife -p my-gcp-project -f region:someregion