一、简介
A REST API FOR SALT
二、安装,配置
yum -y install salt-api
rest_cherrypy:
port:
# disable_ssl: True
ssl_crt: /etc/pki/tls/certs/localhost.crt
ssl_key: /etc/pki/tls/certs/localhost.key
external_auth:
pam:
tabops:
#- .*
- "@wheel"
- "@runner"
- grains.*
启动服务
service salt-master restart;service salt-api start
三、认证、调用API
curl -sSk https://127.0.0.1:1559/login \
-H 'Accept: application/x-yaml' \
-d username=tabops \
-d password=tabops \
-d eauth=pam
复制得到的token
curl -sSk https://127.0.0.1:1559 \
-H 'Accept: application/x-yaml' \
-H 'X-Auth-Token: 7abf0ec365c7257aba0024bb7212200a863aabb9' \
-d client=local \
-d tgt='SCYD-10.25.172.131' \
-d fun=cmd.run \
-d arg='ls'
PS:
salt version
2016.11.8