diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index f98eb9f17f7..99f29712a1c 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -675,7 +675,7 @@ class Distribution(object): self.facts['distribution_release'] = platform.release() self.facts['distribution_version'] = platform.version() - systems_implemented = ('AIX', 'HP-UX', 'Darwin', 'OpenBSD') + systems_implemented = ('AIX', 'HP-UX', 'Darwin', 'FreeBSD', 'OpenBSD') self.facts['distribution'] = self.system @@ -764,6 +764,13 @@ class Distribution(object): data = out.split()[-1] self.facts['distribution_version'] = data + def get_distribution_FreeBSD(self): + self.facts['distribution_release'] = platform.release() + data = re.search('(\d+)\.(\d+)-RELEASE.*', self.facts['distribution_release']) + if data: + self.facts['distribution_major_version'] = data.group(1) + self.facts['distribution_version'] = '%s.%s' % (data.group(1), data.group(2)) + def get_distribution_OpenBSD(self): rc, out, err = self.module.run_command("/sbin/sysctl -n kern.version") match = re.match('OpenBSD\s[0-9]+.[0-9]+-(\S+)\s.*', out)