diff --git a/lib/ansible/modules/network/ios/ios_config.py b/lib/ansible/modules/network/ios/ios_config.py index cff8ebd440..1022419a8a 100644 --- a/lib/ansible/modules/network/ios/ios_config.py +++ b/lib/ansible/modules/network/ios/ios_config.py @@ -322,8 +322,10 @@ def main(): run(module, result) except NetworkError: exc = get_exception() + module.disconnect() module.fail_json(msg=str(exc)) + module.disconnect() module.exit_json(**result)