1:Saltstack安裝node
主---4 minionweb
主:mastervim
創建saltstack yum倉庫windows
1) 導入SaltStack倉庫key:緩存
wget https://repo.saltstack.com/yum/rhel7/SALTSTACK-GPG-KEY.pubthis
rpm --import SALTSTACK-GPG-KEY.puburl
rm -f SALTSTACK-GPG-KEY.pub命令行
2) 建立新的YUM源文件並「/etc/yum.repos.d/saltstack.repo」編輯以下內容debug
####################調試
# Enable SaltStack's package repository
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS 7
baseurl=https://repo.saltstack.com/yum/rhel7
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/rhel7/SALTSTACK-GPG-KEY.pub
3) 安裝SaltStack軟件
yum clean expire-cache
yum update
4) 根據須要安裝salt-minion, salt-master
yum -y install salt-master
yum -y install salt-minion
minion安裝同上,惟一的區別就是第4步安裝客戶端的就行了
5)修改配置啓動服務
主:vim /etc/salt/master
interface: 172.16.0.*
publish_port: 4505
user: **
ret_port: 4506
pidfile: /var/run/salt-master.pid
root_dir: /data/salt_master
conf_file: /etc/salt/master
pki_dir: /etc/salt/pki/master
worker_threads: 4
log_file: /var/log/salt/master
minion:vim /etc/salt/minion
master: 172.16.0.*
master_port: 4506
user: *
root_dir: /data/salt_minion
id: 172.16.0.*
log_file: /var/log/salt/minion
啓動服務
systemctl start salt-master.service
systemctl start salt-minion.service
6) 驗證
主上操做
salt-key -L 或者 salt-key list
salt-key -A ####接受全部key
salt-key -a IP ###加入acceptkey
salt ip cmd.run 'uptime' ###看下是否能獲取到客戶端的信息
salt ‘*’ cmd.run ‘df –h’
問題:
systemctl status salt-minion.service
若客戶端沒有正常啓動,經過查看狀態報錯
[CRITICAL] The Salt Master has rejected this minion's public key!
清除服務端的緩存key,重啓客戶端服務
路徑:根據root_dir master這個配置
/data/salt_master/etc/salt/pki/master/minions
主上查看已經接受的key
[root@GZ-newzzb-207 scripts]# salt-key -L
Accepted Keys:
172.16.0.*
172.16.0.*
172.16.0.*
172.16.0.*
Denied Keys:
172.16.0.*
Unaccepted Keys:
Rejected Keys:
若客戶端的key沒法加入,能夠關閉客戶端服務,開啓調試模式
systemctl stop salt-minion.service
salt-minion –l debug ###經過此命令能夠看到客戶端啓動到是否正常加入的整個過程
擴展(分組)
改master的配置文件
# as the main master config file).
#default_include: master.d/*.conf
改爲
# as the main master config file).
default_include: master.d/*.conf
vi /etc/salt/master.d/nodegroups.conf
nodegroups:
liunxweb: 'L@minion-10-1-110-231,minion-10-1-110-232'
winweb: 'L@minion-10-1-110-233'
salt -N liunxweb test.ping
window
https://repo.saltstack.com/windows/
根文件目錄
C:\salt
能夠去修改目錄conf下minion文件
命令行模式
cd C:\salt
salt-minion stop|start
slalt-minion -l debug