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

Merge pull request #3217 from dagolden/topic/late-sudo_user

Expand sudo_user after variable merging
This commit is contained in:
Michael DeHaan 2013-06-16 19:56:01 -07:00
commit 70a9be27f6
2 changed files with 5 additions and 1 deletions

View file

@ -115,7 +115,7 @@ class Task(object):
self.args = ds.get('args', {})
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)
else:
self.sudo_user = None

View file

@ -387,6 +387,10 @@ class Runner(object):
if self.inventory.basedir() is not None:
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...
items = None
items_plugin = self.module_vars.get('items_lookup_plugin', None)