标签:salt syndic
理论介绍
一个基本的salt配置方式是一个master指挥一群minion,为了不再有假设使用任何单一拓扑结构,考虑多种布局的情况下,主控master可以控制一群master,通过syndic将操作命令传输给受控master,受控master来完成对自己旗下minion的管理,并将结果传回主控master,从而实现了主控master对所有minion的间接管理。
注意:
Syndic上得master配置文件里得file_roots,pillar_roots与主master一致
Syndic 必须运行在master上,并且连接到另一个master(比他更高级)
syndic有点类似于代理,本质上对与主master来说还是minion
数据走向
主master-------syndic-----syndic-master---------minion
salt-minion--------syndic--------主master
实验结构图:
主机说明:
Host IP salt类型
node1 192.168.10.129 salt-master
node2 192.168.10.128 salt-syndic(salt-master)
node1 192.168.10.129 salt-minion
node2 192.168.10.128 salt-minion
编辑主master配置文件以支持syndic
[root@node1 ~]# vim /etc/salt/master order_masters: True [root@node1 ~]# /etc/init.d/salt-master restart
编辑syndic上的master
[root@node2 ~]# yum install -y salt-master salt-syndic [root@node2 ~]# vim /etc/salt/master syndic_master: 192.168.10.129 #指定主master地址 [root@node2 ~]# /etc/init.d/salt-master start [root@node2 ~]# /etc/init.d/salt-syndic start
由于之前搭过master-minion的环境,现在将其key删除(没有的搭过的可以跳过这步)
[root@node2 ~]# /etc/init.d/salt-minion stop [root@node1 ~]# /etc/init.d/salt-minion stop [root@node1 ~]# salt-key -D The following keys are going to be deleted: Accepted Keys: node1 node2 Proceed? [N/y] y Key for minion node1 deleted. Key for minion node2 deleted. [root@node1 ~]# salt-key [root@node1 minion]# cd /etc/salt/pki/minion/ [root@node1 minion]# ll total 12 -rw-r--r--. 1 root root 451 Aug 22 20:22 minion_master.pub -r--------. 1 root root 1679 Aug 22 20:21 minion.pem -rw-r--r--. 1 root root 451 Aug 22 20:21 minion.pub [root@node1 minion]# rm -rf ./* [root@node2 ~]# cd /etc/salt/pki/minion/ [root@node2 minion]# ll total 16 -rw-r--r--. 1 root root 451 Aug 22 20:22 minion_master.pub -r--------. 1 root root 1675 Aug 22 20:21 minion.pem -rw-r--r--. 1 root root 451 Aug 22 20:21 minion.pub -rw-r--r--. 1 root root 451 Aug 23 02:15 syndic_master.pub [root@node2 minion]# rm -rf ./*
给minion指定master(这里指定的是syndic)
[root@node1 salt]# vim /etc/salt/minion master: 192.168.10.128 [root@node2 salt]# vim /etc/salt/minion master: 192.168.10.128 [root@node1 salt]# /etc/init.d/salt-minion start [root@node2 minion]# /etc/init.d/salt-minion start
通过key建立minion和master的联系
[root@node2 ~]# salt-key -A The following keys are going to be accepted: Unaccepted Keys: node1 #syndic接收node1上的minion的key node2 #syndic接收node2上的minion的key Proceed? [n/Y] y Key for minion node1 accepted. Key for minion node2 accepted. [root@node2 ~]# salt-key -L Accepted Keys: node1 node2 Denied Keys: Unaccepted Keys: Rejected Keys:
[root@node1 salt]# salt-key -A The following keys are going to be accepted: Unaccepted Keys: node2 #接收node2syndic的key Proceed? [n/Y] y Key for minion node2 accepted. [root@node1 salt]# salt-key -L Accepted Keys: node2 Denied Keys: Unaccepted Keys: Rejected Keys: [root@node1 salt
主master和syndic-master都管理两个minion
[root@node1 salt]# salt ‘*‘ test.ping node1: True node2: True [root@node2 ~]# salt ‘*‘ test.ping node1: True node2: True
注:https://docs.saltstack.com/en/latest/topics/topology/syndic.html
本文出自 “feng” 博客,请务必保留此出处http://fengxiaoli.blog.51cto.com/12104465/1958790
标签:salt syndic
原文地址:http://fengxiaoli.blog.51cto.com/12104465/1958790