From 3cc1b8d7d3d0983415e87e7ef98c78a55cd614f0 Mon Sep 17 00:00:00 2001 From: Paul Neumann Date: Thu, 8 Nov 2018 15:58:47 +0100 Subject: [PATCH] ios_facts: Strip header from running-config (#48047) IOS prepends a show running-config with lines that are not part of the configuration, keeping the output from being an entirely valid configuration: R1#show run Building configuration... Current configuration : 2045 bytes ... In order to be able to use the config from ios_facts as-is, strip this header. --- lib/ansible/modules/network/ios/ios_facts.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/network/ios/ios_facts.py b/lib/ansible/modules/network/ios/ios_facts.py index 51447c05586..259f5e011fa 100644 --- a/lib/ansible/modules/network/ios/ios_facts.py +++ b/lib/ansible/modules/network/ios/ios_facts.py @@ -282,6 +282,9 @@ class Config(FactsBase): super(Config, self).populate() data = self.responses[0] if data: + data = re.sub( + r'^Building configuration...\s+Current configuration : \d+ bytes\n', + '', data, flags=re.MULTILINE) self.facts['config'] = data