diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index ceea081c448..90180085e3c 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -247,9 +247,9 @@ class NetworkConfig(object): updates = list() for index, line in enumerate(self.items): try: - if line != other[index]: + if str(line).strip() != str(other[index]).strip(): updates.append(line) - except IndexError: + except (AttributeError, IndexError): updates.append(line) return updates