diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index d8055912f9b..6d46637a0a2 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -227,11 +227,22 @@ class NetworkConfig(object): updates.extend(config) break - updates = self.expand(updates) - if self._device_os == 'junos': return updates + changes = list() + for update in updates: + if replace == 'block': + if update.parents: + changes.append(update.parents[-1]) + for child in update.parents[-1].children: + changes.append(child) + else: + changes.append(update) + else: + changes.append(update) + updates = self.expand(changes) + return [item.text for item in self.expand(updates)] def _build_children(self, children, parents=None, offset=0):