diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index fd5729c7c0d..53c4133575f 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -166,6 +166,7 @@ class Facts(object): self.get_local_facts() self.get_env_facts() self.get_dns_facts() + self.get_python_facts() def populate(self): return self.facts @@ -782,6 +783,21 @@ class Facts(object): pass return size_total, size_available + def get_python_facts(self): + self.facts['python'] = { + 'version': { + 'major': sys.version_info[0], + 'minor': sys.version_info[1], + 'micro': sys.version_info[2], + 'releaselevel': sys.version_info[3], + 'serial': sys.version_info[4] + }, + 'version_info': list(sys.version_info), + 'executable': sys.executable, + 'type': sys.subversion[0] + } + + class Hardware(Facts): """ This is a generic Hardware subclass of Facts. This should be further