saltstack日常命令

2019-05-09  本文已影响0人  Tender_刘

cp模块(实现远程文件、目录的复制,以及下载URL文件等操作)(参数 cache_local_file、get_file、get_dir、get_url)

salt '*' cp.get_dir [salt://hellotest](salt://hellotest) /data
salt '*' cp.get_file [salt://hellotest/rocketzhang](salt://hellotest/rocketzhang) /root/rocketzhang
salt '*' cp.get_url [http://xxx.xyz.com/download/0/files.tgz](http://xxx.xyz.com/download/0/files.tgz) /root/files.tgz
client.cmd('*','cp.get_dir',['[salt://path/to/dir','/minion/dest'])](salt://path/to/dir)
salt '*' cmd.run 'netstat -ntlp'
salt '*' cron.set_job root '*/5' '*' '*' '*' '*' 'date >/dev/null 2>&1'
salt '*' cron.raw_cron root
salt '*' cron.rm_job root 'date >/dev/null 2>&1'

为被控主机添加指定的hosts主机配置项

salt '*' dnsutil.hosts_append /etc/hosts 127.0.0.1 [test.com](http://test.com/)
salt '*' file.get_sum /etc/resolv.conf md5
salt '*' file.stats /etc/resolv.conf
salt '*' archive.gzip /tmp/abc.txt
salt '*' network.ip_addrs
salt '*' network.interfaces
salt '*' pkg.install nmap
salt '*' pkg.file_list nmap
salt '*' service.enable crond
salt '*' service.reload crond

注意: 使用模块操作时,请先测试命令是否有问题,没有问题再次执行

salt  "*"   cmd.run "ifconfig"    test
上一篇 下一篇

猜你喜欢

热点阅读