salt -d //查看帮助文档
salt -d | grep service //查看service相关模块命令
salt '*' sys.doc //查看帮助文档
salt-key -L #查询所有接收到的证书
salt-key -a <证书名> #接收单个证书
salt-key -A #接受所有证书
salt-key -d <证书名> #删除单个证书
salt-key -D #删除所有证书
salt '*' service.get_all //获取主机所有服务
salt '*' service.reload sshd //重载sshd服务
salt '*' pkg.list_pkgs //显示软件包版本列表
salt '*' pkg.version python //显示软件包版本信息
salt '*' pkg.install httpd //安装软件包
salt 'node1.com' service.status mysql //查看mysql服务状态
salt 'node1.com' service.start mysql //启动mysql服务
salt 'node1.com' cmd.run 'service mysql status' //与上面一样查看服务
salt '*' sys.list_modules //模块列表
salt-cp '*' /etc/hosts /etc/hosts //把master上的hosts文件分发到所有主机
salt '*' cp.get_file salt://ceshi/b /tmp/test //吧salt-master端相应的文件,分发文件到minion端
salt '*' cp.get_dir salt://zabbix /tmp //吧salt-master端相应的目录,分发文件到minion端
salt '*'file.copy /tmp/zabbix.sls /tmp/sls //吧salt-master端对应文件拷贝到minion端相应目录下
远程命令执行
salt '*' cmd.run 'uptime'//远程命令执行测试
远程调用脚本
'cmd.script:'
salt '*' cmd.script salt://scripts/runme.sh
salt '*' cmd.script salt://scripts/runme.sh 'arg1 arg2 "arg 3"'
salt '*' cmd.script salt://scripts/windows_task.ps1 args=' -Input c:\tmp\infile.txt'shell='powershell'
salt '*' cmd.script salt://scripts/runme.sh stdin='one\ntwo\nthree\nfour\nfive\n''cmd.shell:'
This passes the cmd argument directly totheshell
salt '*' cmd.shell"ls -l | awk '/foo/{print \$2}'"
salt '*' cmd.shell template=jinja "ls -l /tmp/{{grains.id}} | awk '/foo/{print \$2}'"
salt '*' cmd.shell"Get-ChildItem C:\ "shell='powershell'
salt '*' cmd.shell"grep f"stdin='one\ntwo\nthree\nfour\nfive\n'
salt '*' cmd.shell cmd='sed -e s/=/:/g''cmd.shells:'
salt '*' cmd.shells
'cmd.tty:'
salt '*' cmd.tty tty0 'This is a test'
salt '*' cmd.tty pts3 'This is a test''cmd.which:'
salt '*' cmd.which cat
grains选项
salt '*' grains.ls //查看grains分类
salt '*' grains.items //查看grains所有信息
salt '*' grains.item osrelease //查看grains某个信息