1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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,7 +135,13 @@ class Task(object):
# can be hashes and lists, not just scalars # can be hashes and lists, not just scalars
self.args = ds.get('args', {}) self.args = ds.get('args', {})
self.remote_user = ds.get('remote_user', play.playbook.remote_user) # 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: if self.sudo:
self.sudo_user = ds.get('sudo_user', play.sudo_user) self.sudo_user = ds.get('sudo_user', play.sudo_user)