author:headsen chen
date: 2018-09-30 11:22:40
1,建立master端和client端的正常连接
#master yum -y install epel-release yum -y install satl-master sed -i 's/#auto_aucept: False/auto_accept: True/g' /etc/salt/master /etc/salt-maser restart
#minion yum -y install epel-release yum -y install satl-master sed -i 's/salt: master/salt: 192.168.1.130/g' /etc/init.d/satl-minion restart #master salt-key # 等待2分钟就有客户端的key过来了 salt '*' test.ping
2,模拟客户端修改主机名
1,minion端停止服务 /etc/init.d/salt-minion stop 2,master端删除对应的key salt-key -d jack.com # jack.com 为该 minion端的ID 3,minion端修改主机名 sed -i 's/HOSTNAME=jack.com/HOSTNAME=tom.com/g' /etc/sysconfig/network hostname tom.com 4,minion端删除原来的ID rm -f /etc/salt/minion_id rm -rf /etc/salt/pki 5,minion端启用服务 /etc/init.d/salt-minion restart 6,master端上查看新接收的ID salt-key # 等待2分钟 satl 'tom.com' cmd.run 'hostname'