首页 > 系统服务 > 详细

关于ansbile工具的shell、command、script、raw模块的区别和使用场景

时间:2015-09-02 19:07:48      阅读:5265      评论:0      收藏:0      [点我收藏+]

    之前一直误解为shell和command一样是执行远程命令的,最近看了一下官方帮助文档才发现,犯了低级错误,其实每个模块都有自己的应用常用;简单说明一下ansible几个常用模块的区别,以便自己总结。

  1.模块命令详细信息查询

ansible-doc 模块名称

  2.command模块 [执行远程命令]

ansible client -m command -a "uname -n" -s

  3.script模块 [在远程主机执行主控端的shell/python脚本]

ansible client -m script -a "/soft/ntpdate.py" -s

  4.shell模块 [执行远程主机的shell/python脚本]

ansible client -m shell -a "/soft/file.py" -s

  5.raw模块 [类似于command模块、支持管道传递]

ansible client -m raw -a "ifconfig eth0|sed -n 2p|awk ‘{print \$2}‘" -s

 

本文出自 “ˉ、穎濤┃﹎” 博客,请务必保留此出处http://hypocritical.blog.51cto.com/3388028/1690804

关于ansbile工具的shell、command、script、raw模块的区别和使用场景

原文:http://hypocritical.blog.51cto.com/3388028/1690804

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