Centos 7安装salt-stack

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值