http://mirrors.aliyun.com/repo/epel-6.repo
yum repolist 2.安装minion客户端
yum install salt-minion -y
rpm -q salt-minion 3.配置/etc/salt/minion文件
[root@nfs01 /]# vim /etc/salt/minion
# Set the location of the salt master server. Ifthe
master server cannot be
# resolved, then the minion will fail to start.
master: 172.16.1.61 将此行取消注释,并填写master管理端的IP地址(16行),冒号前必须空格
# Explicitly declare the>
if left commented the> # will be the hostname as returned by the python
call: socket.getfqdn()
# Since salt uses detached> multiple minions on the
# same machine but with different> useful for salt compute
# clusters.
id: web01 将此行取消注释,这里是本机在管理端显示的名称(第78行 冒号前必须空格
当然要想简单也可以采用如下方法
sed -i '17i master: 172.16.1.61' /etc/salt/minion
sed -i '78i> 4.设置saltstack客户端开机自启动
chkconfig salt-minion on
chkconfig --list salt-minion 5.将minion服务进行启动
[root@web01 ~]# /etc/init.d/salt-minion start
Starting salt-miniondaemon: [ OK ]
6.当我们回到master管理端执行salt-key命令就可以看到被找到的客户端
[root@m01 ~]# salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
web01
Rejected Keys:
以上结果显示,等待管理的主机有web01 8:salt-key命令的使用
常见参数:
参数
解释
-A
同意并接受全部主机
-a
指定接收的主机,支持通配符操作
-D
删除全部已被管理主机(但是不建议这么做)
-d
指定主机,不在管理的指定主机
这里我们使用-A参数,同意并管理saltstack的所有客户端的主机
[root@m01 ~]# salt-key -A
The following keys are going to be accepted:
Unaccepted
Keys:
web01
Proceed? [n/Y] Y 这里配置选择同意
Key for minion web01 accepted.
[root@m01 ~]# salt-key 当我们再次查看的时候就会发现已经被管理
Accepted
Keys:
web01 表示已经被saltstack
master端管理
Denied Keys:
Unaccepted Keys:
Rejected Keys:
状态说明:
主机状态
中文解释
Unaccepted Keys:
未被接受或同意的主机key
Denied Keys:
已经被拒绝的主机key
Rejected Keys:
明确拒绝的key,主接收任何通信
Accepted Keys:
已经同意被管理的主机key 9:saltstack远程执行命令