ansible常用module

ansible-doc
-l List available modules
-s Show playbook snippet for specified module(s) ansible: ansible <host-pattern> [-f forks] [-m module_name] [-a args]
args:
key=value 注意:command模块要执行命令无须为key=value格式,而是直接给出要执行的命令即可; 常用模块:
command
-a 'COMMAND'
#查看web组磁盘空间使用率
ansible web -m command -a 'df -h' user
-a 'name= state={present|absent} system= uid='
#创建系统账户test,uid为444
ansible test -m user -a 'name=test state=present system=yes uid=444'
ansible test -m user -a 'name=test state=absent' group
-a 'name= gid= state= system=' cron
-a 'name= minute= hour= day= month= weekday= job= user= state='
#每3分钟做一次时间同步
ansible test -m cron -a 'name="custom job" minute=*/3 job="/usr/sbin/ntpdate 172.16.254.23"'
ansible test -m cron -a 'name="custom job" state=absent' copy
-a 'dest= src= mode= owner= group='
ansible test -m copy -a 'src=/root/a.sh dest=/tmp/ owner=root group=root mode=0755' file
-a 'path= mode= owner= group= state={directory|link|present|absent} src='
ansible test -m file -a 'path=/tmp/a.sh state=absent' ping
ansible web -m ping yum
-a 'name= state={present|latest|absent}'
ansible test -m yum -a 'name=httpd state=latest'
ansible test -m yum -a 'name=httpd state=absent' service
-a 'name= state={started|stopped|restarted} enabled='
ansible test -m service -a 'name=httpd state=started enabled=yes' shell
-a 'COMMAND'
ansible test -m shell -a 'chkconfig --list httpd' script
-a '/path/to/script'
ansible test -m script -a '/root/a.sh' setup
ansible web -m setup synchronize
-a 'src= dest= mode={pull|push} rsync_opts="auv"'
ansible webg:webappg -m synchronize -a 'src=/app/webapps/app/ dest=/app/webapps/app/ mode=push rsync_opts="-av"'

最新文章

  1. js快速判断IE浏览器(兼容IE10与IE11)
  2. Linux进程间通信(九):数据报套接字 socket()、bind()、sendto()、recvfrom()、close()
  3. 黑马程序员+ADO.Net基础(中)
  4. 熟练掌握js中this的用法,解析this在不同应用场景的作用
  5. filter应用案例三:解决全站编码问题
  6. ubuntu16.04解决播放swf视频文件问题
  7. SqlServer将没有log文件的数据库文件附加到服务器中
  8. 《深入剖析Tomcat》读书笔记(一)
  9. OC4_XML文件解析
  10. Git CMD - fetch: Download objects and refs from another repository
  11. java 凯撒大帝密码
  12. PHP开发Android应用程序(转)
  13. DHCP租约时间工作原理
  14. zookeeper[3] zookeeper API开发注意事项总结
  15. poj 3400 Dropping the stones
  16. js-数组算法收集版(转)
  17. java8 Lambda表达式的新手上车指南(1)
  18. JAVA核心技术I---JAVA基础知识(不可变对象和字符串)
  19. linux基础之用户登录信息查看命令
  20. (原)Ring loss Convex Feature Normalization for Face Recognition

热门文章

  1. jmeter分布式运行
  2. Hibernate初探之单表映射——第二章:Hibernate进阶
  3. 2019HDU多校Minimal Power of Prime——分段讨论&amp;&amp;思维
  4. 删除harbor项目下的所有镜像
  5. SIGAI深度学习第四集 深度学习简介
  6. ckeditor实现ctrl+v粘贴word图片并上传
  7. .net+文件夹上传
  8. SP1716 GSS3(线段树+矩阵乘法)
  9. 一些特殊的矩阵快速幂 hdu5950 hdu3369 hdu 3483
  10. Geos判断点是否在多边形内