你们都知道cmd.run这个方法好用,能够远程调用命令触发远端机器运行,
和同事讨论的时候发现halite这个平台就是针对这个方法而制做的web平台界面,
搭建容易
至于有研究的同窗可发现,其实halite就是salt-api的替代品
搭建过程:
cd /data/apps/
git clone https://github.com/saltstack/halite
cd halite/halite
./genindex.py -C
#salt-api版本在0.8.2或以上,可使用pip安装,中国就有点慢,你们都懂得
pip install salt-api
pip install cherrypy
#在master添加配置文件
rest_cherrypy:
port: 8000
debug: True
static: /data/apps/halite/halite
app: /data/apps/halite/halite/index.html
ssl_crt: /etc/salt/pki/localhost.crt
ssl_key: /etc/salt/pki/localhost.key
证书我是本身生成的
#生成ssl认证密钥
openssl genrsa -des3 -out localhost.key 1024
openssl req -new -key localhost.key -out localhost.csr
openssl x509 -req -in localhost.csr -signkey localhost.key -out localhost.crt
mv localhost.* /etc/salt/pki/.
#启动
salt-api -d
#须要用到salt的eauth系统,在master添加配置,
external_auth:
pam:
liji*****: (此用户为系统用户名,使用系统认证)
- .*
#访问
http://localhost:8000/app