How Ansible actually works

Ansible is basically written in Python, However it use it's own DSL (Domain Specific Language). You can write using this DSL and ansible will convert it to Python on remote machines to execute tasks. So, it first validates the task syntax and copies the module from the Ansible host to the remote server, and then executes it on the machine itself over SSH.

The result from the execution is returned back to the Ansible host in a json format, so you can match any returned values by knowing its key:

In the case of network devices where Python is installed on the Network Operating System (NOS), Ansible uses either an API ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.