Excecute commands on each node using pvesh

batijuank

Member
Nov 16, 2017
45
0
11
35
I want to execute several commands to each one of my nodes, looking at Proxmox API is possible to send commands to a node using:
Code:
pvesh create /nodes/{node}/execute --commands '["apt update", "apt upgrade pkg1, pkg2, pkg3"]'

However I can't seem to find a proper way to create the JSON. Can anyone help me please?
 
You can run other API commands with this function, not arbitrary shell commands.
Code:
pvesh create /nodes/something/execute --commands '[ {"method":"GET", "path":"status"} ]'

To run shell commands I'd write a small shell script and use SSH.
 
  • Like
Reactions: batijuank
Thanks for helping out, @Dominic .How about this one:
Code:
pvesh get /nodes/asgard/qemu/1080/agent/file-read --file /path/to/file

I'm getting the following error:
Agent error: The command guest-file-open has been disabled for this instance

I'm logged as root
 
From a quick glance into the qemu-ga man page: Have you taken a look at the blacklist?