Ansible安装rpm包/管理服务
* ansible testhost -m yum -a "name=httpd" 不支持name=vim*等通配符
在name后面还可以加上state=installed
* ansible testhost -m service -a "name=httpd state=started enabled=yes" 作用是,设置服务开机启动。相当于chkconfig httpd on一样。
这里的name是centos系统里的服务名,可以通过chkconfig --list查到。state有started,stopped,restarted,reloaded等
* Ansible文档的使用
ansible-doc -l 列出所有的模块
ansible-doc cron 查看指定模块的文档
ansible-doc service 查看指定模块相关的参数