you can do like this:
ansible all -i "<hostname-or-ip>," -a 'uptime'
Note the end of the IP address, or it will be considered the host inventory file name.
Here is an example link:
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
source share