Im trying to figure out how ansible executes the commands on the remote host, I get that it uses ssh/winrm to connect to the remote host but from there it would have to assume the remote host has python/powershell (depends on the os) and all the libraries their code need to run.
so basically what im asking is :

does ansible require the remote host to have python in the right version on it.
does it require the remote host to have the libraries their code uses.
if not does it transfer the modules when it connects and removes them afterwards.
else it may "compile" the modules and transfer them
Ansible works by connecting to your nodes and pushing out small programs, called "Ansible modules" to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules (over SSH by default), and removes them when finished.
how does ansible executes on a remote host?