Hello there,
I am developing an automation on automatic server setup via php.
all stages are ok, as the last process, we need to send commands such as password update, ip change and extra package installations in the server.
I figured out that I would use the /api2/json/nodes/{node}/qemu/{vmid}/agent/exec directory path. but i don't understand how to use it exactly.
I'm able to work with the following command over ssh, but I couldn't figure out how to send the same commands via pve2 php api.
qm guest exec 111 -- "/bin/bash" "-c" "cat /etc/resolv.conf"
sample code
I am developing an automation on automatic server setup via php.
all stages are ok, as the last process, we need to send commands such as password update, ip change and extra package installations in the server.
I figured out that I would use the /api2/json/nodes/{node}/qemu/{vmid}/agent/exec directory path. but i don't understand how to use it exactly.
I'm able to work with the following command over ssh, but I couldn't figure out how to send the same commands via pve2 php api.
qm guest exec 111 -- "/bin/bash" "-c" "cat /etc/resolv.conf"
sample code
Code:
$params = array(
"command" => array(
"--",
"/bin/bash",
"-c",
"cat /etc/resolv.conf"
)
);
var_dump($pve2->post("/nodes/pve10/qemu/111/agent/exec",$params));