1.环境准备https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.210 master
192.168.56.211 minion01
192.168.56.212 minion02
[root@master ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
2.安装salt源https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# sudo rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/latest/SALTSTACK-GPG-KEY.pub
[root@master ~]# curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/latest.repo | sudo tee /etc/yum.repos.d/salt.repo
3.在master节点安装salt
https://www.cndba.cn/hbhe0316/article/106590
https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# yum -y install salt-master salt-minion
4.在minion01和minion02安装salt
[root@minon01 ~]# yum -y install salt-minion
[root@minon02 ~]# yum -y install salt-minion
5.在master节点https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# cat /etc/salt/master | grep -w interface | grep -v "#"
interface: 192.168.56.210
6.在minion节点https://www.cndba.cn/hbhe0316/article/106590
[root@minion01 ~]# cat /etc/salt/minion | grep "master:" | grep -v "#"
master: 192.168.56.210
[root@minion01 ~]# cat /etc/salt/minion | grep "id:" | grep -v "#"
id: minion01
[root@minion02 ~]# cat /etc/salt/minion | grep "master:" | grep -v "#"
master: 192.168.56.210
[root@minion02 ~]# cat /etc/salt/minion | grep "id:" | grep -v "#"
id: minion02
7.启动master节点https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# systemctl restart salt-master
[root@master ~]# systemctl enable salt-master
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
8.启动minion节点
https://www.cndba.cn/hbhe0316/article/106590
[root@minion01 ~]# systemctl restart salt-minion
[root@minion01 ~]# systemctl enable salt-minion
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
[root@minion02 ~]# systemctl restart salt-minion
[root@minion02 ~]# systemctl enable salt-minion
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
7.查看master节点认证列表
https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
master
minion01
minion02
Rejected Keys:
8.对Minion节点认证
[root@master ~]# salt-key -a minion01
The following keys are going to be accepted:
Unaccepted Keys:
minion01
Proceed? [n/Y] y
Key for minion minion01 accepted.
[root@master ~]# salt-key -a minion02
The following keys are going to be accepted:
Unaccepted Keys:
minion02
Proceed? [n/Y] y
Key for minion minion02 accepted.
9.查看是否认证成功https://www.cndba.cn/hbhe0316/article/106590
[root@master ~]# salt '*' test.ping
minion02:
True
minion01:
True
[root@master ~]# salt minion01 test.ping
minion01:
True
[root@master ~]# salt minion02 test.ping
minion02:
True
版权声明:本文为博主原创文章,未经博主允许不得转载。
LINUX