首页 > 其他 > 详细

ansible常用命令大全

时间:2017-08-16 14:37:50      阅读:321      评论:0      收藏:0      [点我收藏+]

ansible ‘*‘ -m command -a ‘uptime‘

‘*‘:自己定义的主机       -m command:命令  

# 检查主机连接

ansible ‘*‘ -m ping

# 执行远程命令

ansible ‘*‘ -m command -a ‘uptime‘

# 执行主控端脚本

ansible ‘*‘ -m script -a ‘/root/test.sh‘

# 执行远程主机的脚本

ansible ‘*‘ -m shell -a ‘ps aux|grep zabbix‘

# 类似shell

ansible ‘*‘ -m raw -a "ps aux|grep zabbix|awk ‘{print \$2}‘"

# 创建软链接

ansible ‘*‘ -m file -a "src=/etc/resolv.conf dest=/tmp/resolv.conf state=link"

# 删除软链接

ansible ‘*‘ -m file -a "path=/tmp/resolv.conf state=absent"

# 复制文件到远程服务器

ansible ‘*‘ -m copy -a "src=/etc/ansible/ansible.cfg dest=/tmp/ansible.cfg owner=root group=root mode=0644"

ansible常用命令大全

原文:http://www.cnblogs.com/bky185392793/p/7373203.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!