yum install wget deltarpm -y
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
master上部署:
yum install salt-master -y
sed -i 's@#file_roots:@file_roots:@g' /etc/salt/master
sed -i 's@# base:@ base:@g' /etc/salt/master
sed -i 's@# - /srv/salt@ - /srv/salt@g' /etc/salt/master
sed -i 's@#pillar_roots:@pillar_roots:@g' /etc/salt/master
sed -i 's@# base:@ base:@g' /etc/salt/master
sed -i 's@# - /srv/pillar@ - /srv/pillar@g' /etc/salt/master
systemctl status salt-master
systemctl enable salt-master
systemctl restart salt-master
systemctl status salt-master
minion上部署:
yum clean all
yum install salt-minion net-tools -y
#内网未部署DNS
sed -i '/#master: salt/s@#master: salt@master: 10.0.91.10@g' /etc/salt/minion #10.0.91.10为master节点IP
sed -i "/#id:/s@#id:@id: `ifconfig eth0|grep -oP '(?<=inet )S+'`@g" /etc/salt/minion
#内网已部署DNS,且已解析salt为master的主机名
sed -i '/#master: salt/s@#master: salt@master: salt@g' /etc/salt/minion
sed -i "/#id:/s@#id:@id: `hostname`@g" /etc/salt/minion
systemctl status salt-minion
systemctl enable salt-minion
systemctl restart salt-minion
systemctl status salt-minion
master上操作:
salt-key -A
salt '*' test.ping