首页 > 其他 > 详细

ansible 常用模块总结

时间:2019-10-17 00:18:59      阅读:64      评论:0      收藏:0      [点我收藏+]

  记录常用的模块功能,详细使用查看官网。

1. file模块

创建软连接
ansible test -m file -a "src=/tmp/conf.d  dest=/tmp/conf.d state=link"


删除目录
ansible test -m file -a "path=/tmp/test.conf  state=absent"

 

 2. synchronize模块

synchronize模块封装rsync,传输文件比copy模块速度快
ansible test  -m synchronize -a "src=/data/conf   dest=/data rsync_opts="--delete,--exclude=.git""

rsync_opts: 指定额外的rsync 参数

 

3. yum模块

ansible  test  -m yum -a "name=nginx"

 

4. script模块

在远程服务器执行本地脚本
ansible test -m script -a  "time.sh"

 

5.shell模块

# 在远程服务器执行shell命令,万能模块
ansible test -m shell -a ‘hostname

 

ansible 常用模块总结

原文:https://www.cnblogs.com/root0/p/11687775.html

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