我们前面讲过了saltstack的c/s,ssh等推送方式,其实我们还可以使用api推送的方式来馆及节点,下面我们就来部署一下api接口的saltstack推送
1.之前因为使用ssh关掉了minion,我们重新先开启
[root@server2 minion]# systemctl start salt-minion
[root@server3 minion]# systemctl start salt-minion
2.配置签名证书
由于现在大多数的api接口使用https的方式,那么我们就来创建证书
[root@server1 salt]# cd /etc/pki/tls/private/
[root@server1 private]# openssl genrsa 1024 我们使用rsa加密,加密位数为1024
Generating RSA private key, 1024 bit long modulus
..............++++++
........................++++++
e is 65537 (0x10001)
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCrpYOCQdtD0AX7FBdBQxpWJjcv++XcD/GSwJAgPZRs+DLsyTyM
YWKyxVroGte3X2vD2XZfoh9tEOK80b/xC6bPaBCGIuSWu6YYp74TgRzCOTP8Fav9
rh8KuO+GR7czFkf/2YHXRNB4b0PBJkQKB9yBiLFNniR20yurGln4G/5gxwIDAQAB
AoGAS0/E4tsobJmSdja7eVwK6y+7WSdqFGM+eEhbNHowbJt+JJyrH2D/YDbtixdz
/LY2X2lD4fQNW9pj0bsqP4YAOxqIz1nB+TaYDssEL9tAOol0n5V8A9sHmf0Y1rBP
Cd+WISMKbpoddazSQq4GBw7s4mP2FBhJs3dspPp3T7qb4NECQQDW7nEe1QDu7rxP
kwLnovpqfn4qshIv+Yfzp09p24rA+MFkY2ZYKzwgktbD9NDGHqinnC5QeGBJWWBF
jYinZWdJAkEAzHHBF9A01ZAvWVf0Mhh70yr2xb1J7uoKOrq3ExTWrz7fyuInj3oj
lPGSd2KPT8psjSSKmwfMR2xjJNB5uuE3jwJAePFnuh/GDK1OTcC967ZsDyzqtf/J
+DED7XmCWGDvrTLNMD42wvphNTsrmszSBgoOgXKDJUj3dY7Te4/vC7Ml8QJAcDAA
EMw9IfBUO0fLhe3vjQpnjkz4FDWz1VR+f+cQg+wRrGh74vzYJ7SEdiTMlbFz7ePe
d4JI8+yjXyFTm1xZOwJAHheLXSk5c7DcW/VKiWe03yU9z+CMHfSEKL2qLdg2wtZi
SFEi3ioaS6NZYCHXwUGeHnU5MmOahMve3/yUZg0hUA==
-----END RSA PRIVATE KEY-----
[root@server1 private]# openssl genrsa 1024 > localhost.key
[root@server1 private]# ls
localhost.key
[root@server1 private]# cd ..
[root@server1 tls]# cd certs/
[root@server1 certs]# ls
ca-bundle.crt ca-bundle.trust.crt make-dummy-cert Makefile renew-dummy-cert
[root@server1 certs]# make testcert 因为这里有makefile的脚本文件,所以我们直接使用它来创建证书
3.编辑api.conf和auth.conf配置文件