{"id":18446475,"url":"https://github.com/kb-perbyte/debuggingnetworkresourcemodule","last_synced_at":"2026-03-19T04:25:58.268Z","repository":{"id":113617167,"uuid":"394134629","full_name":"KB-perByte/debuggingNetworkResourceModule","owner":"KB-perByte","description":"Debugging Network Resource Modules for Ansible","archived":false,"fork":false,"pushed_at":"2023-05-31T16:48:21.000Z","size":422,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T17:55:55.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KB-perByte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-09T03:23:48.000Z","updated_at":"2023-02-13T10:35:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"c756278e-67a8-4680-b0ab-1441c02fc46b","html_url":"https://github.com/KB-perByte/debuggingNetworkResourceModule","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KB-perByte/debuggingNetworkResourceModule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KB-perByte%2FdebuggingNetworkResourceModule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KB-perByte%2FdebuggingNetworkResourceModule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KB-perByte%2FdebuggingNetworkResourceModule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KB-perByte%2FdebuggingNetworkResourceModule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KB-perByte","download_url":"https://codeload.github.com/KB-perByte/debuggingNetworkResourceModule/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KB-perByte%2FdebuggingNetworkResourceModule/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271747023,"owners_count":24813604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:09:28.824Z","updated_at":"2026-02-13T14:03:27.533Z","avatar_url":"https://github.com/KB-perByte.png","language":null,"readme":"# Debugging Ansible Module with VS Code\n\nDebugging Ansible modules with VS code as the most interactive way,\n\n#### Getting the module:\n\nAfter getting the module installed from ansible-galaxy,or git clone the collection with all necessary dependencies\n\n```\nansible-galaxy collection install cisco.ios\n```\n\nLook for the path where the module sits and establish VS code at the same location.\n\n```\n┌[machine@machine]-(~/.a/c/a/c/ios)\n└\u003e pwd\n~/.ansible/collections/ansible_collections/cisco/ios\n┌[machine@machine]-(~/.a/c/a/c/ios)\n└\u003e code.\n```\n\n#### Configuring VS code:\n\n_(Use the same setting with a different port for debugging multiple modules)_\nOnce we are in vs code with the specific module we wish to debug, either use the debug option followed by the settings sign tagged ‘Open launch.json’ to generate the launch configuration file\n\n![Alt text](./images/image_debugPanel.png?raw=true \"Debugging option\")\n\n_Or_\n\nUse the following commands to the root of the collection for generating the same\n\n```\n┌[machine@machine]-(~/.a/c/a/c/i)\n└\u003e mkdir .vscode\n┌[machine@machine]-(~/.a/c/a/c/i/.vscode)\n└\u003e nano launch.json\n```\n\nDrop the below config in your launch.json\n\n```\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Python: Attach\",\n            \"type\": \"python\",\n            \"request\": \"attach\",\n            \"port\": 3000 ,\n            \"host\": \"127.0.0.1\",\n            \"justMyCode\": false\n        },\n    ]\n}\n```\n\nGet debugpy and install it within the scope of your environment.\n\n`pip install debugpy`\n\nTo start debugging go to the intended module and put the following lines on top of it,\n\n```\nimport debugpy\ndebugpy.listen(3000)\ndebugpy.wait_for_client()\n```\n\nWell, the last step\n\nYour inventory file should contain the specified variable\n\n```\n[all:vars]\nansible_network_import_modules=True\n```\n\nNow right after running your playbook using ansible-playbook\n\n```\n[machine@machine]-(~/W/debug_example)\n└\u003e ansible-playbook debug_playbook.yml\n```\n\nExpect the execution to be stuck at the task execution level waiting for you to manually start the module and add it to port 3000 (or any configured port).\n\nNavigating to the module where debugpy import was used press F5 to start debugging\n\n![Alt text](./images/image_debugging.png?raw=true \"Debugging demo\")\n\nAt this point, the debugger should hit your break points when in process.\n\nFor debugging ansible-navigator check a cool doc [here]: https://github.com/shatakshiiii/debuggingNavigator/blob/main/README.md\n\nRefer to the VS code debugging guide for more information-\nhttps://code.visualstudio.com/docs/editor/debugging\n\n#### Works with:\n\n- older Network Modules\n- newer Network Resource Modules\n- execution with Ansible Navigator\n\n## Happy Debugging !!!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkb-perbyte%2Fdebuggingnetworkresourcemodule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkb-perbyte%2Fdebuggingnetworkresourcemodule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkb-perbyte%2Fdebuggingnetworkresourcemodule/lists"}