# How to debug Ansible modules

**URL:** <https://forum.ansible.com/t/how-to-debug-ansible-modules/30484>\
**Category:** Ansible Project\
**Created:** [June 4, 2019, 7:05am UTC](https://forum.ansible.com/t/how-to-debug-ansible-modules/30484 "2019-06-04T07:05:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wawrzek\_Niewodniczan](https://avatars.discourse-cdn.com/v4/letter/w/bbe5ce/32.png) [@Wawrzek\_Niewodniczan](https://forum.ansible.com/u/Wawrzek_Niewodniczan)\
**Post date:** [June 4, 2019, 7:05am UTC](https://forum.ansible.com/t/how-to-debug-ansible-modules/30484/1 "2019-06-04T07:05:19Z")

</div>

Hi,

I'm looking to peek into an Ansible module. It is the 'unarchvie'  
module which in special circumstances is not idempotent  
([https://github.com/ansible/ansible/issues/57303](https://github.com/ansible/ansible/issues/57303)). I read the code. It  
looks sensible to me. Now, I would like to check how it actually works  
with some data.

Thanks,  
Wawrzek

---

<div class="post-metadata">

**Author:** ![Pshem\_Kowalczyk](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Pshem\_Kowalczyk](https://forum.ansible.com/u/Pshem_Kowalczyk)\
**Post date:** [June 4, 2019, 8:14am UTC](https://forum.ansible.com/t/how-to-debug-ansible-modules/30484/2 "2019-06-04T08:14:20Z")

</div>

This should be of help: [https://docs.ansible.com/ansible/latest/dev\_guide/debugging.html](https://docs.ansible.com/ansible/latest/dev_guide/debugging.html)

kind regards  
Pshem

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 4, 2019, 9:34am UTC](https://forum.ansible.com/t/how-to-debug-ansible-modules/30484/3 "2019-06-04T09:34:43Z")

</div>

The unarchive has some nice debug option but they are commented out on line 436[1], 590[2] and 870[3].  
And with the callback plugin debug you get some nice output, and you can always add more "err +=" to get more output.

I might have spotted the bug in finding the debug line numbers, this PR 43479[4] in line 317  
pwname has become pwnam

[1] [https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L436](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L436)  
[2] [https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L590](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L590)  
[3] [https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L870](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/unarchive.py#L870)  
[4] [https://github.com/ansible/ansible/pull/43479/files#diff-5947943aa1aba46541842caf34f526aeR317](https://github.com/ansible/ansible/pull/43479/files#diff-5947943aa1aba46541842caf34f526aeR317)

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 4, 2019, 9:47am UTC](https://forum.ansible.com/t/how-to-debug-ansible-modules/30484/4 "2019-06-04T09:47:00Z")

</div>

It's not it's called pwname  
[https://docs.python.org/2/library/pwd.html#pwd.getpwnam](https://docs.python.org/2/library/pwd.html#pwd.getpwnam)
