官方源:https://repo.saltstack.com/yum/redhat/ saltstack yum源
系统环境
# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
Saltstack安装版本
# salt -V
Salt Version:
Salt: 2017.7.2
Dependency Versions:
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 1.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.8.1
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.2.1511 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-327.el7.x86_64
system: Linux
version: CentOS Linux 7.2.1511 Core
安装步骤和基本配置
1台master 10.10.10.1 master-node
1台minion 10.10.10.2 minion-node
master节点
# yum install -y salt-master salt-minion
# cat /etc/salt/master |grep -v "#" |grep -v "^ *$"
interface: 10.10.10.1qa
state_top: top.sls
file_roots:
base:
- /etc/salt/base
prod:
- /etc/salt/prod
pillar_roots:
base:
- /etc/salt/pillar/base
prod:
- /etc/salt/pillar/prod
minion节点
#yum install -y salt-minion
#vim /etc/salt/minion
master: 10.10.10.1
id: 10.10.10.2
启动master和minion服务
master端
# systemctl start salt-master.service
#4505端口用户消息发布、4506用户接收minion返回消息
minion端
# systemctl start salt-minion.service
#systemctl start salt-minion
想查看saltstack具体进程,可以安装一个python-setproctitle库
# yum install -y python-setproctitle
# systemctl restart salt-master
master端
# tree /etc/salt/pki
/etc/salt/pki
├── master
└── minion
├── minion.pem
└── minion.pub #这是minion的公钥
# salt-key #查看连接成功的minion
# salt-key -a 10.10.10.2 # -a认证参数
# salt-key
Accepted Keys: #认证成功的minion
# salt ‘*‘ test.ping 测试
# salt ‘*‘ cmd.run ‘w‘
salt-key -L ##查看所有minion_key
salt-key -a ‘key-name‘ ##接受该key
salt-key -A ##接受所有key