From 59477d2e9a19c6014bc842ccc90cb4715195bade Mon Sep 17 00:00:00 2001 From: Tongliang Liu Date: Mon, 29 Sep 2014 13:25:46 -0700 Subject: [PATCH] Added support of returning owner's group name in stat module --- lib/ansible/modules/files/stat.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/files/stat.py b/lib/ansible/modules/files/stat.py index 2a9189e532..1544a02880 100644 --- a/lib/ansible/modules/files/stat.py +++ b/lib/ansible/modules/files/stat.py @@ -66,6 +66,7 @@ import os import sys from stat import * import pwd +import grp def main(): module = AnsibleModule( @@ -141,6 +142,9 @@ def main(): pw = pwd.getpwuid(st.st_uid) d['pw_name'] = pw.pw_name + + grp_info = grp.getgrgid(pw.pw_gid) + d['gr_name'] = grp_info.gr_name except: pass