# ansible-doc 模块名称
ansible-doc shell
ansible-doc -s shell
#删除
state=absent


#查看远程主机内存
ansible appservers -m command -a "free -m"

# -m 默认是command
ansible appservers -a free

#ping远程主机
ansible -m ping appservers

# -u 指定用户
ansible appservers -m ping -u bruce

#执行主控端的shell
ansible appservers -m script -a "/shell/freem.sh"

#执行被控端的shell
ansible appservers -m shell -a "/shell/freem.sh"

# command 执行远程权限范围所有的shell命令 管道不支持
# script 在远程主机执行主控端存储的shell脚步 相当于scp+shell组合
# shell功能是执行远程主机的shell脚本
# 从主控端 复制到被控端
ansible appservers -m copy -a 'src=/shell/copyfile dest=/shell backup=yes'
# 从被控端的的日志/tmp/my.log     放到主控端的/tmp目录
ansible appservers -m fetch -a 'src=/tmp/my.log dest=/tmp'
# 相当于 mkdir -p
ansible appservers -m file -a "dest=/path/to/c mode=755 state=directory"
#创建用户
ansible all -m user -a "name=mytest password=123456"
# -b sudo以root权限执行
ansible appservers -b -a "tail /var/log/dmesg"
#查看文件分区
ansible appservers -a 'df -h'
# chdir 切换目录
ansible appservers -a 'chdir=/tmp pwd'
ansible appservers -a 'getent passwd root'

ansible appservers -a 'getenforce'
# 卸载httpd
ansible appservers -m yum -a 'name=httpd state=removed'


ansible testservers -m service -a "name=docker state=started"