From 99bcbe746f2475d3f77ef2b6456c278e3a2df1c7 Mon Sep 17 00:00:00 2001 From: cdigiovanni Date: Tue, 20 Jan 2015 10:58:14 -0600 Subject: [PATCH] Add the uuid of the device in ansible_mounts variable --- lib/ansible/module_utils/facts.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index be6939259a9..48c8b6b78cf 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -795,6 +795,13 @@ class LinuxHardware(Hardware): size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail) except OSError, e: continue + lsblkPath = module.get_bin_path("lsblk") + rc, out, err = module.run_command("%s -ln --output UUID %s" % (lsblkPath, fields[0]), use_unsafe_shell=True) + + if rc == 0: + uuid = out.strip() + else: + uuid = 'NA' self.facts['mounts'].append( {'mount': fields[1], @@ -804,6 +811,7 @@ class LinuxHardware(Hardware): # statvfs data 'size_total': size_total, 'size_available': size_available, + 'uuid': uuid, }) def get_device_facts(self):