Skip to content

Commit

Permalink
Merge pull request ansible#4425 from jeromew/ansible_sudo_user_with_i…
Browse files Browse the repository at this point in the history
…tems

Template sudo_user via with_items
  • Loading branch information
jctanner committed Oct 11, 2013
2 parents d21a028 + dec364a commit 65ef6a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/ansible/runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def __init__(self,
self.private_key_file = private_key_file
self.background = background
self.sudo = sudo
self.sudo_user = sudo_user
self.sudo_user_var = sudo_user
self.sudo_user = None
self.sudo_pass = sudo_pass
self.is_playbook = is_playbook
self.environment = environment
Expand Down Expand Up @@ -431,10 +432,6 @@ def _executor_internal(self, host, new_stdin):
if self.inventory.src() is not None:
inject['inventory_file'] = self.inventory.src()

# 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)
Expand Down Expand Up @@ -527,6 +524,9 @@ def _executor_internal(self, host, new_stdin):
def _executor_internal_inner(self, host, module_name, module_args, inject, port, is_chained=False, complex_args=None):
''' decides how to invoke a module '''

# late processing of parameterized sudo_user (with_items,..)
if self.sudo_user_var is not None:
self.sudo_user = template.template(self.basedir, self.sudo_user_var, inject)

# allow module args to work as a dictionary
# though it is usually a string
Expand Down

0 comments on commit 65ef6a6

Please sign in to comment.