Hi,
Has anyone found a good way to debug ansible modules via the PyCharm debugger?
-T
Hi,
Has anyone found a good way to debug ansible modules via the PyCharm debugger?
-T
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](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
Thanks, Jon. I’ll poke around.
-T
also look at hacking/test-module, it allows a debugger to attach to test a module directly
Good idea. Thanks.
-T
Hi Smith,
Found any good way to accomplish this? Debugging Ansible modules via PyCharm debugger?
I figured out a way to debug using PyCharm remote debugger. I have written down the steps here if anyone else needs info:
https://github.com/mmumshad/debug-ansible-modules-pycharm
Thanks
Mumshad
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.
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
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
Is there a way to debug without having to purchase the professional version of Pycharm?