From 4dce9dc7965a80c3abd7fb9c0c0b42abc15024b7 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 24 Oct 2017 17:33:27 -0400 Subject: [PATCH] Add ansible_distribution_major_version to macOS (#31708) --- lib/ansible/module_utils/facts/system/distribution.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index 815352fe77..48314baea0 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -487,7 +487,9 @@ class Distribution(object): darwin_facts['distribution'] = 'MacOSX' rc, out, err = self.module.run_command("/usr/bin/sw_vers -productVersion") data = out.split()[-1] - darwin_facts['distribution_version'] = data + if data: + darwin_facts['distribution_major_version'] = data.split('.')[0] + darwin_facts['distribution_version'] = data return darwin_facts def get_distribution_FreeBSD(self):