常用模块命令

模块 ping

  1. ansible -i /root/workspace/inventory/test.ini group002 -m ping

常见返回值

image.png

模块 shell

  1. ansible -i /root/workspace/inventory/test.ini group001 -m shell -a "free -m"

image.png

  1. ansible -i /etc/ansible/hosts web-servers -m script -a "./script.sh"