1.配置 file 模块文件
# cd /srv/salt
# vim shell_test.sls
shell_test:
cmd.script:
- source: salt://test/1.sh # 服务端的脚本
- user: root
#客户端的用户
vim 1.sh
#!/bin/bash
touch /tmp/111.txt
if [ -d /tmp/1233 ]
then
rm -rf /tmp/1233
else
else
mkdir /tmp/1233
fi
2.
创建模块配置
# vim top.sls
base:
'
slave-puppet.zjcap.cn':
- shell_test
3.运行创建文件
salt '
slave-puppet.zjcap.cn' state.highstate