测试环境:CentOS6.6 X86_64
# cat /etc/hosts 192.168.199.61 Ansible 192.168.199.60 Nginx1 192.168.199.62 Nginx2 192.168.199.63 Haproxy
YUM 源
# wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
安装saltstack
只需要一台安装master即可,其他的全部安装minion.
安装salt-master
# yum -y install salt-master enablerepr=epel-testing
安装salt-minion
#yum -y install salt-minion enablerepr=epel-testing
配置saltstack
minion配置
# echo '192.168.199.61 Ansible' >> /etc/hosts # sed -i 's/#master: salt/ master: Ansible/g' /etc/salt/minion # cat /etc/salt/minion | grep "^ master" master: Ansible
看清楚了master前面有两个空格,这行代码表示要连接的saltstack的master是Ansible
master配置
# sed -i 's/#interface: 0.0.0.0/ interface: 192.168.199.61/g' /etc/salt/master # cat /etc/salt/master | grep '^ interface' interface: 192.168.199.61
master监听192.168.199.61,老样子前面也是有两个空格,否则启动的时候会报错.
启动saltstack
启动master
# service salt-master start
Starting salt-master daemon: [ OK ]
启动minion
#service salt-minion start
Starting salt-minion daemon: [ OK ]
测试
参照:http://www.ttlsa.com/saltstack/install-saltstack-on-linux/