使用saltstack作集中化管理平台,有一点不好的就是它属于C/S类型,每一台被控minion主机都需要安装一个salt-minion.
官方提供了一个salt-ssh可以用于批量操作,把账号密码等信息按指定格式写到/etc/salt/roster文件里面,再用salt-ssh命令执行命令。类似这样:
自写Python3脚本
脚本如下:
#!/usr/bin/python3
#author wugf
import paramiko
import re
import configparser
## 安装步奏
install = [
"yum remove salt* -y",
"rm -fr /etc/salt",
"yum install http://repo.saltstack.com/py3/redhat/salt-py3-repo-2018.3-1.el7.noarch.rpm -y -y",
"yum -y install epel-release"