架构
server1 master 写好httpd nginx 等salt
server2 3 minion
server4 top master
server4
vim /etc/salt/master
order_masters: True
server1
yum install salt-syndic -y
vim /etc/salt/master
syndic_master: server4
systemctl start salt-syndic
systemctl restart salt-master
server4
[root@server4 ~]# salt-key -L
salt-key -A
server4
salt server2 test.ping
[root@server4 ~]# salt '*' test.ping
server1:
True
server2:
True
server3:
True
salt server2 state.sls httpd.service
相当于级联,server4不需要salt文件就可以通过master下达指令
[root@server4 ~]# salt '*' state.highstate
server2:
----------
ID: /etc/httpd/conf/httpd.conf
Function: file.managed
Result: True
Comment: File /etc/httpd/conf/httpd.conf is in the correct state
Started: 09:35:34.869931
Duration: 245.621 ms