签到成功

知道了

CNDBA社区CNDBA社区

Centos 7安装salt-stack

2022-01-22 15:13 1707 0 原创 Linux
作者: hbhe0316

1.环境准备

http://www.cndba.cn/hbhe0316/article/106590
http://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源http://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

http://www.cndba.cn/hbhe0316/article/106590

[root@master ~]# yum -y install salt-master salt-minion

4.在minion01和minion02安装salthttp://www.cndba.cn/hbhe0316/article/106590

[root@minon01 ~]# yum -y install salt-minion
[root@minon02 ~]# yum -y install salt-minion

5.在master节点http://www.cndba.cn/hbhe0316/article/106590

[root@master ~]# cat /etc/salt/master | grep -w interface | grep -v "#"
interface: 192.168.56.210

6.在minion节点

http://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节点

http://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节点http://www.cndba.cn/hbhe0316/article/106590

http://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节点认证列表

[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.查看是否认证成功

[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

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:2586858次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ