標籤:
1.匯入安裝源
centos5
rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
centos6
rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
2.安裝salt軟體包
master端
yum install salt-master
minion端(俗稱的client端)
yum install salt-minion
3.配置修改
master端
[[email protected] ~]# sed -e ‘s/#.*//‘ -e ‘/^$/ d‘ /etc/salt/master interface: 0.0.0.0publish_port: 4505user: rootmax_open_files: 100000ret_port: 4506pidfile: /var/run/salt-master.pidsyndic_log_file: syndic.loglog_file: /var/log/salt/masterkey_logfile: /var/log/salt/keylog_fmt_logfile: ‘%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s‘
minion端
[[email protected] ~]# sed -e ‘s/#.*//‘ -e ‘/^$/ d‘ /etc/salt/minionmaster: salt.server.365dw.cnmaster_port: 4506pidfile: /var/run/salt-minion.pidpki_dir: /etc/salt/pki/minionid: client01.server.365dw.cncachedir: /var/cache/salt/minion
4.重啟服務端及用戶端
master端:
/etc/init.d/iptables stop/etc/init.d/salt-master restart
minion端:
/etc/init.d/iptables stop/etc/init.d/salt-minion restart
5.認證認證
slat-key -L 查看後發現Unaccepted keys[[email protected] ~]# salt-key -LAccepted Keys:Unaccepted Keys:client01.server.365dw.cnRejected Keys:salt-key -A 認證,Proceed輸入Y[[email protected] ~]# salt-key -AThe following keys are going to be accepted:Unaccepted Keys:client01.server.365dw.cnProceed? [n/Y] YKey for minion client01.server.365dw.cn accepted.再次salt-key -L查看,Unaccepted Keys未認證的用戶端變成了accept的用戶端。[[email protected] ~]# salt-key -LAccepted Keys:client01.server.365dw.cnUnaccepted Keys:Rejected Keys:
6.測試,使用salt內建的cmd.run命令進行ping 測試。
[[email protected] ~]# salt ‘*‘ cmd.run ‘ping -c1 www.365dw.cn‘client01.server.365dw.cn: PING www.365dw.cn (112.124.43.79) 56(84) bytes of data. 64 bytes from 112.124.43.79: icmp_seq=1 ttl=128 time=12.5 ms --- www.365dw.cn ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 12.534/12.534/12.534/0.000 ms
centos yum安裝saltstack