1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add the uuid of the device in ansible_mounts variable

This commit is contained in:
cdigiovanni 2015-01-20 10:58:14 -06:00
parent 115684d235
commit 99bcbe746f

View file

@ -795,6 +795,13 @@ class LinuxHardware(Hardware):
size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail) size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail)
except OSError, e: except OSError, e:
continue 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( self.facts['mounts'].append(
{'mount': fields[1], {'mount': fields[1],
@ -804,6 +811,7 @@ class LinuxHardware(Hardware):
# statvfs data # statvfs data
'size_total': size_total, 'size_total': size_total,
'size_available': size_available, 'size_available': size_available,
'uuid': uuid,
}) })
def get_device_facts(self): def get_device_facts(self):