Saltstack安装配置指南

0.安装环境及依赖关系: 

CentOS/RHEL 6.5 

Python 2.6 >= 2.6 <3.0

ZeroMQ >= 3.2.0

pyzmq >= 2.2.0 

PyCrypto 

msgpack-python 

YAML

Jinja2 (Salt master服务端配置)

1.安装配置

1.1安装Salt

    For CentOS/RHEL i386:

在salt master及minion上均执行: 

# rpm –Uvh http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm

For CentOS/RHEL x86_64:

在salt master及minion上均执行: 

# rpm –Uvh http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

在salt master 主机端执行:

 # yum install salt-master

在salt minion 客户端执行:

 # yum install salt-minion

设置开机启动:

salt master主机端执行:

# chkconfig --add salt-master

# chkconfig salt-master on

Salt minion客户端执行:

# chkconfig --add salt-minion

# chkconfig salt-minion on

1.2配置Salt

Salt master服务端:

# vim /etc/salt/master

修改一下参数:

  interface: IP_ADRESS

  publish_port: 4505

  file_roots: (文档根目录,可默认不修改)

   base:

     - /home/saltroot/salt

   dev:

     - /home/saltroot/dev

   prod:

     - /home/saltroot/prod

Salt minion客户端:

# vim /etc/salt/minion

修改一下参数:

  master: IP_ADRESS (salt master服务端IP地址)

  id: salt_minion     (salt minion客户端标识id)

检查salt依赖关系

salt master服务端:

# salt  --versions-report

          Salt: 2014.7.0

        Python: 2.6.6 (r266:84292, Sep  4 2013, 07:46:00)

        Jinja2: 2.8-dev

      M2Crypto: 0.20.2

msgpack-python: 0.1.13

  msgpack-pure: 0.1.3

      pycrypto: 2.0.1

       libnacl: 1.1.0

        PyYAML: 3.10

         ioflo: 0.9.38

         PyZMQ: 2.2.0.1

          RAET: 0.2.4

           ZMQ: 3.2.4

salt master客户端:

# salt-minion  --versions-report

          Salt: 2014.1.5

        Python: 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)

        Jinja2: unknown

      M2Crypto: 0.20.2

msgpack-python: 0.1.13

  msgpack-pure: Not Installed

      pycrypto: 2.0.1

        PyYAML: 3.10

         PyZMQ: 2.2.0.1

           ZMQ: 3.2.4

2.运行测试

启动salt master及minion:

# service salt-master start

# service salt-master status

# service salt-minion start

# service salt-minion status

master服务端识别并接受minion

# salt-key –L

Accepted Keys:

Unaccepted Keys:

salt_minion

Rejected Keys:

# salt-key –A

在master上测试与minion的连通性

# salt ‘*’ test.ping

salt_minion:

True

说明master与minion之间能够正常通信。