yyert 发表于 2017-12-6 10:25:32

saltstack 自定义执行模块

                                                #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
# 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

                                       

页: [1]
查看完整版本: saltstack 自定义执行模块