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:
parent
c876ce4b8a
commit
4f13967386
1 changed files with 7 additions and 1 deletions
|
@ -135,7 +135,13 @@ class Task(object):
|
|||
# can be hashes and lists, not just scalars
|
||||
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:
|
||||
self.sudo_user = ds.get('sudo_user', play.sudo_user)
|
||||
|
|
Loading…
Reference in a new issue