Ansible expect python on nodes, Ansible uses SSH + Python
When you run ansible, it reads the ip addresses and credential info from inventory which indirectly specify SSH options
Ansible internally runs a SSH command
Generates a temporary python script (for your configuration) copies that to node
Python on node executes this script
output of that is returned via SSH
Then it cleans up the temporary python script and other files
As a user of ansible we create playbook or adhoc-command to make ansible work.
It is recommended to configure a user on all nodes with key based SSH to work in Ansible as industry standard. This user generally has sudo or privilege escallation.