Debugging code execution
Sometimes logging and inspection of variable data is not enough to troubleshoot a problem. When this happens, it can be necessary to dig deeper into the internals of Ansible. There are two main sets of Ansible code: the code that runs locally on the Ansible host, and the module code that runs remotely on the target host.
Debugging local code
The local Ansible code is the lion's share of the code that comes with Ansible. All the playbook, play, role, and task parsing code live locally. All the task result processing code and transport code live locally. All the code except for the assembled module code that is transported to the remote host lives locally.
Local Ansible code can be broken down into three major sections: inventory, playbook, and runner. Inventory code deals with parsing inventory data from host files, dynamic inventory scripts, or combinations of the two in directory trees. Playbook code is used to parse the playbook YAML code into Python objects within...