Saltstack 安裝應用node
master 192.168.20.156linux
minion 192.168.20.168c++
1、系統準備ssh
[root@master ~]# uname -rtcp
2.6.32-504.el6.x86_64ide
# salt --versionthis
salt 2016.3.3 (Boron)url
一、設置關閉 selinuxspa
[root@master ~]# cat /etc/sysconfig/selinux |grep -v ^#線程
SELINUX=disabled
SELINUXTYPE=targeted
二、設置iptables
# iptables -A INPUT -p tcp --dport 4505 -j ACCEPT
# iptables -A INPUT -p tcp --dport 4506 -j ACCEPT
# /etc/init.d/iptables save
三、安裝 gcc c++
# yum install gcc gcc-c++ -y
四、配置yum 源
# cat /etc/yum.repos.d/saltstack.repo
[saltstack]
name=saltstack
baseurl=https://repo.saltstack.com/yum/rhel6/
enabled=1
gpgcheck=0
# rhel7 能夠以此更改URL 安裝源;
或者wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
或者rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 本人使用這個
五、安裝配置
master:
# yum install salt-master salt-minion salt-ssh salt-syndic salt-cloud -y
六、配置master
# mkdir /srv/{salt,pillar}
# cat /etc/salt/master
interface: 192.168.20.156
# 綁定master通訊IP
publish_port: 4505
master_id: master
auto_accept: True
# 打開key的自動驗證
pidfile: /var/run/salt-master.pid
pki_dir: /etc/salt/pki
file_roots:
base:
- /srv/salt
# 指定saltstack文件根目錄位置
pillar_roots:
base:
- /srv/pillar
# 指定pillar的配置目錄
#
當/etc/salt/master沒有配置auto_accept: True時,須要經過salt-key命令來進行證書認證操做
salt-key -L 顯示已認證或未認證的被控端id
salt-key -D 刪除全部認證主機id證書
salt-key -d id 刪除單個id證書
salt-key -A 接受全部id證書
salt-key -a id 接受單個id證書
salt-key -j id 拒絕單個id證書
salt-key –J 拒絕全部id證書
#
七、啓動
# service salt-master start
# chkconfig salt-master on
八、minion 端:
# yum install salt-minion -y
配置 minion
[root@client ~]# cat /etc/salt/minion
master: 192.168.20.168
id: client
九、啓動
# service salt-minion start
# chkconfig salt-minion on
十、向客戶端發送命令檢測;
[root@master ~]# salt-key -L
# 查看minion 列表
[root@master ~]# salt 'client' test.ping
2、提示問題:
# salt '*' test.ping
[ERROR] Salt request timed out. If this error persists, worker_threads may need to be increased.
Failed to authenticate! This is most likely because this user is not permitted to execute commands, but there is a small possibility that a disk error occurred (check disk/inode usage).
Salt由於握手不成功報錯[要求增長線程]解決辦法?通常都是配置問題
解決方法:
檢測配置文件 /etc/salt/master裏面的worker_threads 參數
檢測 IPtables和4506 4505 端口;