curl -skS "https://xx.xxx.xxx.xxx:8080/run" -H 'Accept: application/x-yaml' -H 'Content-type: application/json' -d '[{
"client": "local",
"tgt": "*",
"fun": "cmd.run",
"name": "df -h",
"username": "ravi",
"password": "teledna",
"eauth": "pam" }]'
我想通过salt-api运行命令。但是我收到了一个错误。 test.ping
工作正常的地方。我想我错过了体内的护身符。任何人都可以指出文档或调整上面的curl命令。感谢。
答案 0 :(得分:2)
您需要使用cmd
curl -skS https://xxx.xxx.xxx.xxx:8080/run \
-H 'Accept: application/x-yaml' \
-H 'Content-type: application/json' \
-d '[{
"client": "local",
"tgt": "*",
"fun": "cmd.run",
"kwarg": {
"cmd": "df -h"
},
"username": "ravi",
"password": "teledna",
"eauth": "auto"
}]'
您需要使用模块中函数的名称,而不是状态。