Search code examples
pythonansibleinfrastructure

how does ansible executes on a remote host?


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 :

  1. does ansible require the remote host to have python in the right version on it.

  2. does it require the remote host to have the libraries their code uses.

  3. if not does it transfer the modules when it connects and removes them afterwards.
  4. else it may "compile" the modules and transfer them

Solution

  • 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.