From 7c772c6af563430086e0759ea9609a76d1a08f3a Mon Sep 17 00:00:00 2001 From: Josh Mandel Date: Thu, 28 Feb 2013 15:54:43 -0800 Subject: [PATCH] Add remote user_id to ansible facts --- library/setup | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/setup b/library/setup index 8c76f3f64f..8060ed5f40 100644 --- a/library/setup +++ b/library/setup @@ -27,6 +27,7 @@ import re import socket import struct import datetime +import getpass DOCUMENTATION = ''' --- @@ -119,6 +120,7 @@ class Facts(object): self.get_pkg_mgr_facts() self.get_lsb_facts() self.get_date_time_facts() + self.get_user_facts() def populate(self): return self.facts @@ -307,6 +309,11 @@ class Facts(object): 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): """ This is a generic Hardware subclass of Facts. This should be further