Added iostype details in network ios_facts module (#46599)
parent
62d131716b
commit
4ba0cfeb4b
|
@ -83,6 +83,10 @@ ansible_net_version:
|
||||||
description: The operating system version running on the remote device
|
description: The operating system version running on the remote device
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
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:
|
ansible_net_hostname:
|
||||||
description: The configured hostname of the device
|
description: The configured hostname of the device
|
||||||
returned: always
|
returned: always
|
||||||
|
@ -176,6 +180,7 @@ class Default(FactsBase):
|
||||||
data = self.responses[0]
|
data = self.responses[0]
|
||||||
if data:
|
if data:
|
||||||
self.facts['version'] = self.parse_version(data)
|
self.facts['version'] = self.parse_version(data)
|
||||||
|
self.facts['iostype'] = self.parse_iostype(data)
|
||||||
self.facts['serialnum'] = self.parse_serialnum(data)
|
self.facts['serialnum'] = self.parse_serialnum(data)
|
||||||
self.facts['model'] = self.parse_model(data)
|
self.facts['model'] = self.parse_model(data)
|
||||||
self.facts['image'] = self.parse_image(data)
|
self.facts['image'] = self.parse_image(data)
|
||||||
|
@ -187,6 +192,13 @@ class Default(FactsBase):
|
||||||
if match:
|
if match:
|
||||||
return match.group(1)
|
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):
|
def parse_hostname(self, data):
|
||||||
match = re.search(r'^(.+) uptime', data, re.M)
|
match = re.search(r'^(.+) uptime', data, re.M)
|
||||||
if match:
|
if match:
|
||||||
|
|
Loading…
Reference in New Issue