Added iostype details in network ios_facts module (#46599)

This commit is contained in:
Sebastien Pouplin 2018-10-10 19:00:25 +07:00 committed by Peter Sprygada
parent 62d131716b
commit 4ba0cfeb4b

View file

@ -83,6 +83,10 @@ ansible_net_version:
description: The operating system version running on the remote device
returned: always
type: string
ansible_net_iostype:
description: The operating system type (IOS or IOS-XE) running on the remote device
returned: always
type: string
ansible_net_hostname:
description: The configured hostname of the device
returned: always
@ -176,6 +180,7 @@ class Default(FactsBase):
data = self.responses[0]
if data:
self.facts['version'] = self.parse_version(data)
self.facts['iostype'] = self.parse_iostype(data)
self.facts['serialnum'] = self.parse_serialnum(data)
self.facts['model'] = self.parse_model(data)
self.facts['image'] = self.parse_image(data)
@ -187,6 +192,13 @@ class Default(FactsBase):
if match:
return match.group(1)
def parse_iostype(self, data):
match = re.search(r'\S+(X86_64_LINUX_IOSD-UNIVERSALK9-M)(\S+)', data)
if match:
return "IOS-XE"
else:
return "IOS"
def parse_hostname(self, data):
match = re.search(r'^(.+) uptime', data, re.M)
if match: