Ansibug - Debugging Modules Workflow Ideas

The next feature I really want to bring to ansibug is the ability to also debug modules at the same time as a playbook itself.

I’ve got a POC that essentially does this and I can debug both Python and PowerShell modules in my local changes but there are a few UX concerns I have. The biggest problem is the overhead added to invoking a module in setting up the debugger. Doing this by default would just slow things down dramatically and is arguably not the best decision.

My current approach is to only activate the module debugger when ansibug steps into a task. For example I’ve placed a breakpoint on a task and by clicking Step Into (F10) it will hook up the module side of things and activate the debugger for that

This works but it requires the 2 steps to first break on the task/host you want to debug with, then step in to actually debug that module.

Another option I’ve been looking at was BreakpointMode to allow a user to set a specific breakpoint mode on the task that would optionally break on the task (default) or on the module invocation (new mode). Unfortunately these modes cannot be defined by the extension and only appear once a new session has started. The UX for setting them isn’t the best as well as you need to right click the breakpoint, edit breakpoint, then set the mode in the expression.

My gut feeling is to have both as an option as it gives flexibility on both ways. I was also considering having the VSCode extension request breakpoints set for .py or .ps1 files and check if they will be run for the current task but:

  • I’m unsure if that can actually be done
  • We could miss modules an action plugin may run, e.g. we only really have the task name

There are other limitations right now with the Python and PowerShell debugging side but as it’s a POC I am hoping to find ways around those limitations but it is still very early days.

If anyone has any other suggestions or thoughts on this functionality I would love to hear it.