Excecute commands on each node using pvesh

batijuank

Member
Nov 16, 2017
33
0
6
30
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?
 

Dominic

Proxmox Staff Member
Staff member
Mar 18, 2019
115
17
18
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

batijuank

Member
Nov 16, 2017
33
0
6
30
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
 

Dominic

Proxmox Staff Member
Staff member
Mar 18, 2019
115
17
18
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 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 your own in 60 seconds.

Buy now!