Excecute commands on each node using pvesh

batijuank

Member
Nov 16, 2017
45
0
11
34
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?
 

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!