环境配置
1. salt-master 10.139.60.110
2. salt-minion 10.139.60.120
查看内核
[root@log ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@log ~]# uname -r
2.6.32-642.11.1.el6.x86_64
下载阿里云yum源
[root@log ~]# wget -O/etc/yum.repos.d/CentOS-Base.repo
安装epel-release和 salt-master软件包
[root@log ~]# yum install epel-release salt-master -y
修改master配置文件
[root@log ~]# vim /etc/salt/master
file_roots: 配置文件位置
pillar_roots: 注释打开
[root@log ~]# mkdir /srv/{salt,pillar}
启动服务
[root@log ~]# /etc/init.d/salt-master start
master检查minion客户端
[root@log ~]# salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
backpro
Rejected Keys:
错误解决
[root@log ~]# salt ‘*‘ cmd.run ‘df -h‘
No minions matched the target. No commandwas sent, no jid was assigned.
ERROR: No return received
这个问题是没有接受minion key
执行[root@log ~]# salt-key -A 就可以
客户端安装minion
[root@back ~]# yum install salt-minion -y
修改minion端配置文件
[root@back ~]# vim /etc/salt/minion
master: 10.139.60.110 添加master IP地址
id: backpro 添加ID标识
启动服务
systemctl start salt-minion.service
[root@back ~]# salt-minion -l debug 查看minion报错
master端测试:
[root@log ~]# salt ‘*‘ test.ping 检查主机是否存在
back.weiyin.com:
True
[root@log ~]# salt ‘*‘ cmd.run ‘df -h‘ 检查所有主机磁盘信息
到此saltstack以安装完毕,请大家拍砖。
本文出自 “在路上” 博客,请务必保留此出处http://zailushang.blog.51cto.com/1199537/1895774
原文:http://zailushang.blog.51cto.com/1199537/1895774