mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Expand sudo_user after variable merging
Previous commit c3659741 expanded sudo_user during task construction,
but this is too early as it does not pick up variables set during
the play.
This commit moves sudo_user expansion to the runner after variables
have been merged.
This commit is contained in:
@@ -115,7 +115,7 @@ class Task(object):
|
|||||||
self.args = ds.get('args', {})
|
self.args = ds.get('args', {})
|
||||||
|
|
||||||
if self.sudo:
|
if self.sudo:
|
||||||
self.sudo_user = template.template(play.basedir, ds.get('sudo_user', play.sudo_user), module_vars)
|
self.sudo_user = ds.get('sudo_user', play.sudo_user)
|
||||||
self.sudo_pass = ds.get('sudo_pass', play.playbook.sudo_pass)
|
self.sudo_pass = ds.get('sudo_pass', play.playbook.sudo_pass)
|
||||||
else:
|
else:
|
||||||
self.sudo_user = None
|
self.sudo_user = None
|
||||||
|
|||||||
@@ -386,6 +386,10 @@ class Runner(object):
|
|||||||
if self.inventory.basedir() is not None:
|
if self.inventory.basedir() is not None:
|
||||||
inject['inventory_dir'] = self.inventory.basedir()
|
inject['inventory_dir'] = self.inventory.basedir()
|
||||||
|
|
||||||
|
# late processing of parameterized sudo_user
|
||||||
|
if self.sudo_user is not None:
|
||||||
|
self.sudo_user = template.template(self.basedir, self.sudo_user, inject)
|
||||||
|
|
||||||
# allow with_foo to work in playbooks...
|
# allow with_foo to work in playbooks...
|
||||||
items = None
|
items = None
|
||||||
items_plugin = self.module_vars.get('items_lookup_plugin', None)
|
items_plugin = self.module_vars.get('items_lookup_plugin', None)
|
||||||
|
|||||||
Reference in New Issue
Block a user