vi /etc/yum.repos.d/CentOS-Base.repo
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS $releasever
enabled=1
gpgcheck=1
yum -y install salt-minion
查看版本
salt-call --versions-report
客户端配置安装
注意安装salt-minion
1、修改hosts
添加
172.16.3.1 salt
2、修改配置文件/etc/salt/minion
先备份原来的minion,再用minion.rpmnew替换minion
id: hostname
3、重启salt
/etc/init.d/salt-minion restart
服务器端配置
注意安装salt-master
在172.16.3.1上面协商saltkey
1、查看是否对应服务器是否被信任
#salt-key -L ##-L 列表
2、添加信任
#salt-key -a hostname ##-a accept
3、测试是否连通
#salt hostname test.ping
4、在服务器端编辑对应客户端配置文件
/srv/pillar/appcfg
5、编辑init.sls,添加对应配置信息
若是双主,类似
#钱盒gas
{% if grains['fqdn'] == 'SHPD-I04-SRV02' or grains['fqdn'] == 'SHPD-I03-SRV02' %}
include:
- appcfg.gas
{% endif %}
6、验证fqdn是否正确
salt SHPD-I03-SRV02 grains.item fqdn
检测连通性
salt2 target(hostname) appdeploy.pappcfg user
salt2 相当于重命名salt,防提权,例
salt2 SHPD-H04-SRV09 appdeploy.go workbench 2015-11-19/workbench-20151119.inc.zip