PyCharm & Modules

412 views
Skip to first unread message

Tennis Smith

unread,
Oct 29, 2014, 12:52:11 PM10/29/14
to ansible...@googlegroups.com
Hi,

Has anyone found a good way to debug ansible modules via the PyCharm debugger?  

-T

Jon Forrest

unread,
Oct 29, 2014, 4:49:45 PM10/29/14
to ansible...@googlegroups.com

I did a little looking into this. The first problem is making Ansible
not delete the modules on the remote host. The documentation page

http://docs.ansible.com/developing_modules.html#check-mode

mentions how to do this, although it would be nice if there were
a module-specific directive that turned this on for just the
one module, something like

tasks:
   - name: ensure apache is at the latest version
     yum: pkg=httpd state=latest module-save=True

That said, my understanding is that the remote modules don't
require anything other than standard python, which is why Ansible
isn't required on the remote node. So, you "should" be able to run
a remote module using your favorite debugging method. I haven't
tried this, and I'm not an Ansible expert, so I'd be interested
in finding out if this works.

Jon Forrest




 

Tennis Smith

unread,
Oct 29, 2014, 5:07:40 PM10/29/14
to ansible...@googlegroups.com
Thanks, Jon.  I'll poke around.
-T

Brian Coca

unread,
Oct 29, 2014, 5:13:29 PM10/29/14
to ansible...@googlegroups.com
also look at hacking/test-module, it allows a debugger to attach to test a module directly

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f53fcde4-3d13-4b37-91a7-1fce57f5e435%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Tennis Smith

unread,
Oct 29, 2014, 6:38:13 PM10/29/14
to ansible...@googlegroups.com
Good idea. Thanks.
-T

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/m7uYtbvEWKo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Michael DeHaan

unread,
Oct 30, 2014, 4:42:32 PM10/30/14
to ansible...@googlegroups.com

Mumshad Mannambeth

unread,
Sep 5, 2016, 10:10:30 PM9/5/16
to Ansible Project
Hi Smith,

Found any good way to accomplish this? Debugging Ansible modules via PyCharm debugger?

Mumshad Mannambeth

unread,
Sep 6, 2016, 12:44:42 PM9/6/16
to Ansible Project
I figured out a way to debug using PyCharm remote debugger. I have written down the steps here if anyone else needs info:


Thanks
Mumshad

Deepak Kothandan

unread,
Sep 26, 2016, 2:10:15 PM9/26/16
to Ansible Project
Hi All,

Firstly, I would like to thank Mumshad Mannambeth, for sharing his github document which helped me in doing the setup.

I have written a couple of post on debugging Ansible using Pycharm.

1) Setting up pycharm and a ubuntu vagrant box, to debug Custom Ansible modules, so the ansible code stays on the host, and is easier to develop, The link to this post is Debugging Ansible with Pycharm

2) Using the same setup, also wrote a second post, which explains about debugging existing modules and callback plugins and the link is Debugging Ansible callbacks with pycharm 

Hope this helps. Thanks

Jae Kim

unread,
Nov 30, 2017, 1:48:03 AM11/30/17
to Ansible Project
Is there a way to debug without having to purchase the professional version of Pycharm?
Reply all
Reply to author
Forward
0 new messages