diff --git a/lib/ansible/modules/network/ios/ios_l3_interface.py b/lib/ansible/modules/network/ios/ios_l3_interface.py index 826535f9794..45b5f9c0ffc 100644 --- a/lib/ansible/modules/network/ios/ios_l3_interface.py +++ b/lib/ansible/modules/network/ios/ios_l3_interface.py @@ -302,12 +302,7 @@ def main(): if commands: if not module.check_mode: - response = load_config(module, commands) - for item in response: - for cmd, rsp in iteritems(item): - for err in ('Error:', 'overlaps with', 'Bad mask'): - if err in rsp: - module.fail_json(msg="command '%s' failed with error '%s'." % (cmd, rsp)) + load_config(module, commands) result['changed'] = True diff --git a/lib/ansible/plugins/terminal/ios.py b/lib/ansible/plugins/terminal/ios.py index 42ecfe64ee3..fa2072d27fc 100644 --- a/lib/ansible/plugins/terminal/ios.py +++ b/lib/ansible/plugins/terminal/ios.py @@ -43,6 +43,10 @@ class TerminalModule(TerminalBase): re.compile(br"connection timed out", re.I), re.compile(br"[^\r\n]+ not found"), re.compile(br"'[^']' +returned error code: ?\d+"), + re.compile(br"Bad mask", re.I), + re.compile(br"% ?(\S+) ?overlaps with ?(\S+)", re.I), + re.compile(br"[%\S] ?Error: ?[\s]+", re.I), + re.compile(br"[%\S] ?Informational: ?[\s]+", re.I) ] def on_open_shell(self):