實現2個master,當這兩個master運行時均可以向minion發送命令。html
salt 版本vim
1 [root@salt100 ~]# salt --version 2 salt 2018.3.3 (Oxygen) 3 [root@salt100 ~]# salt-minion --version 4 salt-minion 2018.3.3 (Oxygen)
salt 多master文檔架構
https://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
說明:spa
根據規劃在salt01建立冗餘的master。rest
yum install -y salt-master
1 # 拷貝的祕鑰 2 /etc/salt/pki/master/master.pem 3 /etc/salt/pki/master/master.pub 4 # 拷貝主master的配置 5 /etc/salt/master 6 # 拷貝主master的目錄 7 /srv
1 systemctl enable salt-master.service # 開機自啓動 2 systemctl start salt-master.service # 啓動salt-master
每臺minion機器都操做code
1 [root@salt02 ~]# vim /etc/salt/minion 2 ………… 3 # Set the location of the salt master server. If the master server cannot be 4 # resolved, then the minion will fail to start. 5 #master: salt 6 # 修改後的配置以下 7 master: 8 - salt100 9 - salt01 10 ………… 11 [root@salt02 ~]# systemctl restart salt-minion.service
1 [root@salt01 ~]# salt-key 2 Accepted Keys: 3 Denied Keys: 4 Unaccepted Keys: 5 salt01 6 salt02 7 salt03 8 salt100 9 Rejected Keys: 10 [root@salt01 ~]# salt-key -A 11 The following keys are going to be accepted: 12 Unaccepted Keys: 13 salt01 14 salt02 15 salt03 16 salt100 17 Proceed? [n/Y] Y 18 Key for minion salt01 accepted. 19 Key for minion salt02 accepted. 20 Key for minion salt03 accepted. 21 Key for minion salt100 accepted.
1 salt '*' pillar.items 2 salt '*' pillar.item level1:level2:my_user:0 3 salt '*' grains.item roles
———————————————END———————————————server