Created
June 6, 2019 21:26
-
-
Save smurugap/614b85d0a7cb9a2709029a31d0e82951 to your computer and use it in GitHub Desktop.
Debug ansible module failures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Set ANSIBLE_KEEP_REMOTE_FILES env before executing the playbook and run the playbook with -vvvv | |
for eg: | |
ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook -i inventory/ playbooks/install_contrail.yml -vvvv | |
2) Look for PUT message in the logs corresponding to the task... | |
for eg: | |
<10.87.69.8> (0, 'sftp> put /root/.ansible/tmp/ansible-local-279680i0RrK/tmpXVp8uT /root/.ansible/tmp/ansible-tmp-1559855484.58-20011953793704/AnsiballZ_docker_service.py\n' | |
3) On the remote host cd to the directory and unzip the file | |
for eg: | |
cd /root/.ansible/tmp/ansible-tmp-1559855484.58-20011953793704/ | |
python AnsiballZ_docker_service.py explode | |
4) debug_dir would have been created with __main__.py, args file and the dependent python modules | |
for eg: | |
root@5b12s10-node2:~/.ansible/tmp/ansible-tmp-1559855484.58-20011953793704# ls debug_dir/ | |
__main__.py ansible args | |
5) You may add pdb inside the python modules or the __main__.py and run the module locally | |
for eg: | |
python AnsiballZ_docker_service.py execute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment