SaltStack配置

82264356 2019-06-20

SaltStack配置

内容:实现master和minions的配置及远程命令


配置环境如下:
主机系统:ubuntu 14.04

192.168.136.128 master ub
192.168.136.130 minion1 ub1 [webserver]
192.168.136.131 minion2 ub2 [dbserver]

修改/etc/hosts

192.168.136.128    ub
192.168.136.130    ub1
192.168.136.131    ub2

1.配置Master

修改/etc/salt/master

interface: 192.168.136.128

然后重启salt-master服务

service salt-master restart

在每个minion中配置/etc/salt/minion

master: 192.168.136.128

重启salt-minion服务
然后重启salt-master服务

service salt-minion restart

2.启动salt

2.1.master
然后重启salt-master服务

#salt-master

minion

#salt-minion

3.key management

3.1 master

#salt-key -L
Accepted Keys:
Unaccepted Keys:
ub1
ub2
Rejected Keys:

接受minions的keys

root@ubuntu:~# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
ub1
ub2
Proceed? [n/Y] Y
Key for minion ub1 accepted.
Key for minion ub2 accepted.
root@ubuntu:~# salt-key -L
Accepted Keys:
ub1
ub2
Unaccepted Keys:
Rejected Keys:

4.发送命令

master

root@ubuntu:~# salt 'ub1' test.ping
ub1:
    True
root@ubuntu:~# salt '*' test.ping
ub1:
    True
ub2:
    True

相关推荐