images\cherry_red.png1 Ansible
      images\cherry_blue.png1.1 ansible安装部署
   images\cherry_red.png2 功能模块
      images\cherry_blue.png2.1 playbook
      images\cherry_blue.png2.2 command模块
      images\cherry_blue.png2.3 shell模块
      images\cherry_blue.png2.4 copy模块
      images\cherry_blue.png2.5 package模块
      images\cherry_blue.png2.6 file模块
      images\cherry_blue.png2.7 fetch模块
      images\cherry_blue.png2.8 cron模块
      images\cherry_blue.png2.9 template模块
      images\cherry_blue.png2.10 service模块
      images\cherry_blue.png2.11 yum模块
      images\cherry_blue.png2.12 user模块
      images\cherry_blue.png2.13 group模块
      images\cherry_blue.png2.14 script模块
      images\cherry_blue.png2.15 setup模块
shell模块可以在远程主机上调用shell解释器运行命令,支持shell的各种功能,例如管道等。


ansible Test -m shell -a 'cat /etc/passwd | grep "root"'

images\4-1.png



ansible $HOSTS -m copy -a "src=/opt/scripts/warperror.sh dest=/opt/sys_scripts/warperror.sh mode=u+x" -e ansible_python_interpreter=python3


ansible $HOSTS -m shell -a 'cd /opt/sys_scripts/ ; /bin/bash /opt/sys_scripts/warperror.sh' -e ansible_python_interpreter=python3