Ansible debug: Keep remote files and execute them manually

Set the environment variable ANSIBLE_KEEP_REMOTE_FILES=1 on local machine to keep files that Ansible copied to the remote host, so that you can execute them directly on the remote host yourself and thus troubleshoot them better:

on local machine /Control Machine/:

$ ansible-playbook ...

on remote host /Managed Node/:

$ cd ~/.ansible/tmp/
$ python ./ansible-/