diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py index 838b03aca05..3cd8f1a321c 100644 --- a/lib/ansible/module_utils/ios.py +++ b/lib/ansible/module_utils/ios.py @@ -133,6 +133,7 @@ def load_config(module, commands): continue rc, out, err = exec_command(module, command) if rc != 0: + exec_command(module, 'end') module.fail_json(msg=to_text(err, errors='surrogate_then_replace'), command=command, rc=rc) exec_command(module, 'end')