Fixes #4536 Get the remote_user from multiple sources in a preferred order

This commit is contained in:
James Tanner 2013-10-21 12:07:51 -04:00
parent c876ce4b8a
commit 4f13967386

View file

@ -135,6 +135,12 @@ class Task(object):
# can be hashes and lists, not just scalars
self.args = ds.get('args', {})
# get remote_user for task, then play, then playbook
if ds.get('remote_user') is not None:
self.remote_user = ds.get('remote_user')
elif ds.get('remote_user', play.remote_user) is not None:
self.remote_user = ds.get('remote_user', play.remote_user)
else:
self.remote_user = ds.get('remote_user', play.playbook.remote_user)
if self.sudo: