mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #9128 from msabramo/expose_more_user_facts
Expose more facts about user on host system
This commit is contained in:
commit
e4a7b973fd
1 changed files with 7 additions and 0 deletions
|
@ -29,6 +29,7 @@ import socket
|
||||||
import struct
|
import struct
|
||||||
import datetime
|
import datetime
|
||||||
import getpass
|
import getpass
|
||||||
|
import pwd
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import StringIO
|
import StringIO
|
||||||
|
|
||||||
|
@ -551,6 +552,12 @@ class Facts(object):
|
||||||
# User
|
# User
|
||||||
def get_user_facts(self):
|
def get_user_facts(self):
|
||||||
self.facts['user_id'] = getpass.getuser()
|
self.facts['user_id'] = getpass.getuser()
|
||||||
|
pwent = pwd.getpwnam(getpass.getuser())
|
||||||
|
self.facts['user_uid'] = pwent.pw_uid
|
||||||
|
self.facts['user_gid'] = pwent.pw_gid
|
||||||
|
self.facts['user_gecos'] = pwent.pw_gecos
|
||||||
|
self.facts['user_dir'] = pwent.pw_dir
|
||||||
|
self.facts['user_shell'] = pwent.pw_shell
|
||||||
|
|
||||||
def get_env_facts(self):
|
def get_env_facts(self):
|
||||||
self.facts['env'] = {}
|
self.facts['env'] = {}
|
||||||
|
|
Loading…
Reference in a new issue