From 2f887c6dca0ea101a6165a5575220dad46a8e869 Mon Sep 17 00:00:00 2001 From: r-p-e Date: Sun, 15 Sep 2013 17:58:29 +0200 Subject: [PATCH] Add some more OpenBSD facts added: * ansible_distribution * ansible_distribution_release * ansible_distribution_version --- library/system/setup | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/system/setup b/library/system/setup index e39910fb4e..75e10af630 100644 --- a/library/system/setup +++ b/library/system/setup @@ -268,6 +268,15 @@ class Facts(object): self.facts['distribution'] = 'FreeBSD' self.facts['distribution_release'] = platform.release() self.facts['distribution_version'] = platform.version() + elif self.facts['system'] == 'OpenBSD': + self.facts['distribution'] = 'OpenBSD' + self.facts['distribution_release'] = platform.release() + rc, out, err = module.run_command("/sbin/sysctl -n kern.version") + data = re.search('OpenBSD\s[0-9]+.[0-9]+(-\S+)?\s.*', out) + if data: + self.facts['distribution_version'] = data.groups()[0][1:] + else: + self.facts['distribution_version'] = 'release' else: dist = platform.dist() self.facts['distribution'] = dist[0].capitalize() or 'NA'