实现2个master,当这两个master运行时都可以向minion发送命令。
salt 版本
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
说明:
根据规划在salt01创建冗余的master。
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机器都操作
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———————————————