hello_module.py
#!/usr/bin/env python def say_hello(): return 'hello salt'hello_module.py 保存在 ,Master 目录/srv/salt/_modules/下。
执行同步modules命令, 将扩展模块文件 同步(拷贝)到minion端。 # salt '*' saltutil.sync_modules执行完毕之后,mimion 端 hello_module.py 存放如下:
Window 端,路径下: C:\salt\var\cache\salt\minion\extmods_modules\hello_module.py ,扩展模块存放位置 C:\salt\var\cache\salt\minion\files\base_modules\hello_module.py , 临时存放位置
Linux 端,路径下: /var/cache/salt/minion/extmods/_modules/hello_module.py ,扩展模块存放位置 /salt/var/cache/salt/minion/files/_modules/hello_module.py , 临时存放位置
http://www.tuicool.com/articles/j22YNb https://www.xiaomastack.com/2014/11/18/salt-api/