#cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
192.168.90.177 app-LT-177 master (安裝salt-master)
192.168.90.178 app-LT-178 syndic (安裝salt-mater和salt-syndic)
192.168.90.185 app-LT-185 syndic (安裝salt-mater和salt-syndic salt-minion)
192.168.90.186 app-LT-186 minion (安裝salt-minion)
1.master 執行salt命令去執行時,是根據syndic2上定義的pillar、grains和定義的sls文件去執行的
- 執行擴展模塊時候,需要去syndic2上去編寫擴展模塊。 _modules 要放到file_roots下
mkdir -pv /etc/salt/base/_modules
[root@app-LT-185 _modules]# cat hello.py
#!/usr/binpython
import os
def world():
return 'haha'
3.在master上執行同步模塊
同步模塊至Minion可使用下列三個命令之一:
state.highstate
saltutil.sync_modules
saltutil.sync_all
#salt '192.168.90.186' saltutil.sync_modules
192.168.90.186:
- modules.hello
#salt '192.168.90.186' hello.world
192.168.90.186:
haha