# 检查主机连接
# ansible test -m ping

# 执行远程命令
# ansible test -m command -a 'uptime'

# 执行主控端脚本
# ansible test -m script -a '/etc/ansible/script/test.sh'

# 执行远程主机的脚本
# ansible test -m shell -a 'ps aux|grep zabbix'

# 类似shell
# ansible test -m raw -a "ps aux|grep zabbix|awk '{print \$2}'"

# 创建软链接
# ansible test -m file -a "src=/etc/resolv.conf dest=/tmp/resolv.conf state=link"

# 删除软链接
# ansible test -m file -a "path=/tmp/resolv.conf state=absent"

# 复制文件到远程服务器
# ansible test -m copy -a "src=/etc/ansible/ansible.cfg dest=/tmp/ansible.cfg owner=root group=root mode=0644"

# 指定主机
#ansible -i /etc/ansible/hosts all -m copy -a "src=test.conf dest=/etc/test.conf owner=root group=root mode=0644"
#确保一个包已经安装,但是不进行update操作
#ansible webservers -m yum -a "name=acme state=installed"

#查看已经安装了指定版本的软件包
#ansible webservers -m yum -a "name=acme-1.5 state=installed"

#查看安装软件包是否为最新版本
#ansible webservers -m yum -a "name=acme state=latest"

#确保一个软件包是没有安装的
#ansible webservers -m yum -a “name=acme state=removed" #'user'模块可以方便的创建或者操作一个用户帐号,同样的也可以删除一个用户
#ansible all -m user -a "name=test password=<abc>"
#ansible all -m user -a "name=test state=absent"

#确定服务都是开启的
#ansible all -m service -a "name=httpd state=started"
#重启服务
#ansibel all -m service -a "name=httpd state=restarted"
#关闭服务
#ansible all -m service -a "name=httpd state=stoped"
#get_url从服务器上下载一个文件到远程主机指定的目录
#ansible webservers -m get_url -a "url='http://baidu.com dest=/tmp/ba.html" #setup收集远程服务器信息
#ansible all -m setup

  

最新文章

  1. KNN算法
  2. rcnn学习(六):imdb.py学习
  3. wamp虚拟主机的配置 .
  4. Android BlueDroid(一):BlueDroid概述 【转】
  5. HDU 4336:Card Collector(容斥原理)
  6. excel的常用公式
  7. java中的IO整理
  8. oralce 函数 FOR windows 跟踪神器
  9. Linux操作系统安装Nvidia显卡驱动
  10. SCJP_104——题目分析(4)
  11. Jexus下配置多个站点
  12. ListView列表项
  13. 巧妙使用Firebug插件,快速监控网站打开缓慢的原因
  14. Asp.Net+Easyui实现重大CRUD
  15. v9手机版文章内容不显示
  16. php-迭代创建级联目录
  17. [Swift]LeetCode767. 重构字符串 | Reorganize String
  18. pythonのsimple_tag
  19. Oracle的条件in包含NULL时的处理
  20. Qt对`vtable的未定义引用

热门文章

  1. 用vue-cli快速构建项目
  2. php字符串读取函数
  3. P1462 通往奥格瑞玛的道路(二分答案+最短路)
  4. An problem about date 根据年月日计算 星期几
  5. 基于Android SDK安装PhoneGap框架
  6. Django总结二
  7. 如何解决error LNK2001(转载)
  8. android UI 操作 不要在子线程中操作UI
  9. [转]Android定时刷新UI界面----Handler
  10. [转]使用ThinkPHP框架快速开发网站(多图)