From 4bf6b9aa2787845192293258af43a58ee0336ad3 Mon Sep 17 00:00:00 2001 From: rahushen Date: Wed, 13 Sep 2017 07:41:00 -0400 Subject: [PATCH] Fixes #27138 (#29064) (cherry picked from commit bc6e015a8671097ea51545bead34c25e6c8f390e) --- lib/ansible/modules/network/nxos/nxos_facts.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index 24da20f2b3..9de6e0f38e 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -209,7 +209,7 @@ class FactsBase(object): class Default(FactsBase): - VERSION_MAP = frozenset([ + VERSION_MAP_7K = frozenset([ ('sys_ver_str', 'version'), ('proc_board_id', 'serialnum'), ('chassis_id', 'model'), @@ -217,10 +217,21 @@ class Default(FactsBase): ('host_name', 'hostname') ]) + VERSION_MAP = frozenset([ + ('kickstart_ver_str', 'version'), + ('proc_board_id', 'serialnum'), + ('chassis_id', 'model'), + ('kick_file_name', 'image'), + ('host_name', 'hostname') + ]) + def populate(self): data = self.run('show version', 'json') if data: - self.facts.update(self.transform_dict(data, self.VERSION_MAP)) + if data.get('sys_ver_str'): + self.facts.update(self.transform_dict(data, self.VERSION_MAP_7K)) + else: + self.facts.update(self.transform_dict(data, self.VERSION_MAP)) class Config(FactsBase):