ansible-doc -l 列出所有模块
ansible-doc <模块名>   文档
ansible-doc  -s  <模块名>  简略文档
远程命令模块
ansible webservers -m command -a "free -m"
ansible webservers -m script -a "/home/test.sh 12 34"
ansible webservers -m shell -a "/home/test.sh"
copy模块
ansible webservers -m copy -a "src=/home/test.sh dest=/tmp/ owner=rootgroup=root mode=0755"
stat模块
ansible webservers -m stat -a "path=/etc/sysctl.conf"
 get_url模块
ansible webservers -m get_url -a "url=http://www.baidu.com dest=/tmp/index.htmlmode=0440 force=yes"
安装软件
ansible webservers -m apt -a "pkg=curl state=latest"
ansible webservers -m yum -a "name=curl state=latest"
cron模块
ansible webservers -m cron -a "name='check dirs' hour='5,2' job='ls -alh > /dev/null'"
mount模块
ansible webservers -m mount -a "name=/mnt/data src=/dev/sd0 fstype=ext3
opts=rostate=present"
service模块
ansible webservers -m service -a "name=nginx state=stopped"
ansible webservers -m service -a "name=nginx state=restarted"
ansible webservers -m service -a "name=nginx state=reloaded"
sysctl包管理模块
sysctl: name=kernel.panic value=3 sysctl_file=/etc/sysctl.conf checks=beforereload=yessalt '*' pkg.upgrade
user模块
#添加用户johnd;
ansible webservers -m user -a "name=johnd comment='John Doe'"
#删除用户johnd;
ansible webservers -m user -a "name=johnd state=absent remove=yes"

results matching ""

    No results matching ""