saltstack 服务配置
一、服务环境--------------------------------------------------------------
序号设备型号设备IP设备用途
1虚拟机192.168.122.100salt master
2虚拟机192.168.122.101salt minion
3虚拟机192.168.122.102salt minion
4虚拟机192.168.122.103salt minion
5虚拟机192.168.122.104salt minion
6虚拟机192.168.122.105salt minion
二、相关saltstack rpm安装包
----------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
libyaml-0.1.3-1.4.el6.x86_64.rpm
openpgm-5.1.118-3.el6.x86_64.rpm
python-babel-0.9.4-5.1.el6.noarch.rpm
python-backports-1.0-3.el6.x86_64.rpm
python-backports-ssl_match_hostname-3.4.0.2-1.el6.noarch.rpm
python-chardet-2.0.1-1.el6.noarch.rpm
python-jinja2-2.2.1-2.el6_5.x86_64.rpm
python-msgpack-0.1.13-3.el6.x86_64.rpm
python-ordereddict-1.1-2.el6.noarch.rpm
python-requests-1.1.0-4.el6.noarch.rpm
python-six-1.7.3-1.el6.noarch.rpm
python-urllib3-1.5-7.el6.noarch.rpm
python-zmq-14.3.1-1.el6.x86_64.rpm
PyYAML-3.10-3.1.el6.x86_64.rpm
salt-2014.7.0-3.el6.noarch.rpm
salt-master-2014.7.0-3.el6.noarch.rpm
salt-minion-2014.7.0-3.el6.noarch.rpm
sshpass-1.05-1.el6.x86_64.rpm
zeromq3-3.2.4-1.el6.x86_64.rpm
三、首先在salt-master服务端上利用写好的脚本安装服务端和客户端(服务端上也需要安装客户端的)
1
2
3
# ./install_saltstack.sh
***if you want to use this machine as a salt-server,choose 1
***if you want to use this machine as a salt-client,choose 2
四、配置saltsatck
4.1 master配置
1
2
3
4
# vim /etc/salt/master
# cat /etc/salt/master |grep "^interface"
interface: 192.168.122.100
#
4.2 minion配置
1
2
3
4
# vim /etc/salt/minion
# cat /etc/salt/minion|grep "^master"
master: 192.168.122.100
#
五、启动saltstack
5.1 启动master并加入开机自启动
1
2
3
4
5
6
7
8
# chkconfig --list|grep salt
salt-master 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
salt-minion 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
# service salt-master start
Starting salt-master daemon: [确定]
# service salt-minion start
Starting salt-minion daemon: [确定]
#
六、测试saltstack
接下来的命令都在master上执行
6.1 查看minion列表
1
2
3
4
5
# salt-key -L
Accepted Keys:
Unaccepted Keys:
nagios-monitor
Rejected Keys:
6.2 接收所有key
1
2
3
4
5
6
# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
nagios-monitor
Proceed? Y
Key for minion nagios-monitor accepted.
6.3 简单测试
1
2
3
# salt "*" test.ping
nagios-monitor:
True
七、在其他客户端上安装客户端相关rpm软件包
7.1 安装相关软件包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# ./install_saltstack.sh
***if you want to use this machine as a salt-server,choose 1
***if you want to use this machine as a salt-client,choose 2
you want to use this machine as [ salt-server(=1)|salt-client(=2) ]:2
warning: libyaml-0.1.3-1.4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ###########################################
1:libyaml ###########################################
warning: PyYAML-3.10-3.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ###########################################
1:PyYAML ###########################################
warning: python-babel-0.9.4-5.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ###########################################
1:python-babel ###########################################
warning: python-jinja2-2.2.1-2.el6_5.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ###########################################
1:python-jinja2 ###########################################
warning: python-msgpack-0.1.13-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-msgpack ###########################################
warning: python-chardet-2.0.1-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-chardet ###########################################
warning: python-ordereddict-1.1-2.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-ordereddict ###########################################
warning: python-backports-1.0-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-backports ###########################################
warning: python-backports-ssl_match_hostname-3.4.0.2-1.el6.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 17ed316d: NOKEY
Preparing... ###########################################
1:python-backports-ssl_ma###########################################
warning: python-six-1.7.3-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-six ###########################################
warning: python-urllib3-1.5-7.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-urllib3 ###########################################
warning: python-requests-1.1.0-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-requests ###########################################
warning: openpgm-5.1.118-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:openpgm ###########################################
warning: zeromq3-3.2.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:zeromq3 ###########################################
warning: python-zmq-14.3.1-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:python-zmq ###########################################
warning: sshpass-1.05-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:sshpass ###########################################
warning: salt-2014.7.0-3.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:salt ###########################################
warning: salt-minion-2014.7.0-3.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ###########################################
1:salt-minion ###########################################
7.2 修改客户端相关配置文件以及启动客户端服务(参照上面步骤四和步骤五)
八、接收客户端key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# salt-key -L
Accepted Keys:
nagios-monitor
namenode
Unaccepted Keys:
datanode01
datanode02
datanode03
datanode04
Rejected Keys:
# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
datanode01
datanode02
datanode03
datanode04
Proceed? Y
Key for minion datanode01 accepted.
Key for minion datanode02 accepted.
Key for minion datanode03 accepted.
Key for minion datanode04 accepted.
页:
[1]