From 407dc2dc68cbbcab8a1cb9b1cb93e6c7469a2bfb Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Tue, 1 Aug 2017 23:21:25 +0530 Subject: [PATCH] fix nxos_vrf removal failure (#27547) Signed-off-by: Trishna Guha --- lib/ansible/modules/network/nxos/nxos_vrf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_vrf.py b/lib/ansible/modules/network/nxos/nxos_vrf.py index 50ecdbbe48..3e6d0600d1 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf.py @@ -257,15 +257,15 @@ def main(): command = get_commands_to_config_vrf(delta, vrf) commands.extend(command) - if commands: + if state == 'present' and commands: if proposed.get('vni'): if existing.get('vni') and existing.get('vni') != '': commands.insert(1, 'no vni {0}'.format(existing['vni'])) - if not module.check_mode: - load_config(module, commands) - + if commands and not module.check_mode: + load_config(module, commands) results['changed'] = True + if 'configure' in commands: commands.pop(0)