mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #2245 from jmandel/add_user_fact
Add remote user_id to ansible facts
This commit is contained in:
commit
bd9c64e014
1 changed files with 7 additions and 0 deletions
|
@ -27,6 +27,7 @@ import re
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
import datetime
|
import datetime
|
||||||
|
import getpass
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
|
@ -119,6 +120,7 @@ class Facts(object):
|
||||||
self.get_pkg_mgr_facts()
|
self.get_pkg_mgr_facts()
|
||||||
self.get_lsb_facts()
|
self.get_lsb_facts()
|
||||||
self.get_date_time_facts()
|
self.get_date_time_facts()
|
||||||
|
self.get_user_facts()
|
||||||
|
|
||||||
def populate(self):
|
def populate(self):
|
||||||
return self.facts
|
return self.facts
|
||||||
|
@ -307,6 +309,11 @@ class Facts(object):
|
||||||
self.facts['date_time']['time'] = now.strftime('%H:%M:%S')
|
self.facts['date_time']['time'] = now.strftime('%H:%M:%S')
|
||||||
|
|
||||||
|
|
||||||
|
# User
|
||||||
|
def get_user_facts(self):
|
||||||
|
self.facts['user_id'] = getpass.getuser()
|
||||||
|
|
||||||
|
|
||||||
class Hardware(Facts):
|
class Hardware(Facts):
|
||||||
"""
|
"""
|
||||||
This is a generic Hardware subclass of Facts. This should be further
|
This is a generic Hardware subclass of Facts. This should be further
|
||||||
|
|
Loading…
Reference in a new issue