你可以这样做:
原文链接:https://www.f2er.com/bash/384470.htmlansible all -i "<hostname-or-ip>," -a 'uptime'
请注意,在IP地址的末尾,或者它将被视为主机库存文件名.
以下是一个参考示例:
ansible all -i "192.168.33.100," -a 'uptime' 192.168.33.100 | SUCCESS | rc=0 >> 12:05:10 up 10 min,1 user,load average: 0.46,0.23,0.08