Hey @Ruth, you can use ansible without using the hosts file in the following way
ansible all -i "<hostname-or-ip>," -a 'uptime'
Make sure you add a ',' at the end of the IP address, or it will be considered as hosts inventory filename.
Example:
ansible all -i "192.168.56.105," -a 'uptime'
192.168.56.105 | SUCCESS | rc=0 >>
12:05:10 up 10 min, 1 user, load average: 0.46, 0.23, 0.08