From 58a5f8dfaf5896de936af13dbef690e7a579941f Mon Sep 17 00:00:00 2001 From: Mihir Joshi Date: Wed, 18 Feb 2015 17:10:36 -0500 Subject: [PATCH] Pulls machine id in ansible facts - Fix #10221 --- lib/ansible/module_utils/facts.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 6d602af736..ca4f50cada 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -387,7 +387,10 @@ class Facts(object): break else: self.facts['distribution'] = name - + machine_id = get_file_content("/var/lib/dbus/machine-id") or get_file_content("/etc/machine-id") + if machine_id: + machine_id = machine_id.split('\n')[0] + self.facts["machine_id"] = machine_id self.facts['os_family'] = self.facts['distribution'] if self.facts['distribution'] in OS_FAMILY: self.facts['os_family'] = OS_FAMILY[self.facts['distribution']]