Allow su_user to be templated, same as sudo_user.

pull/5275/merge
Adam Heath 11 years ago committed by James Cammarata
parent b8d3c0f865
commit fac7c6d3fe

@ -193,7 +193,8 @@ class Runner(object):
self.callbacks.runner = self self.callbacks.runner = self
self.original_transport = self.transport self.original_transport = self.transport
self.su = su self.su = su
self.su_user = su_user self.su_user_var = su_user
self.su_user = None
self.su_pass = su_pass self.su_pass = su_pass
if self.transport == 'smart': if self.transport == 'smart':
@ -585,6 +586,8 @@ class Runner(object):
# late processing of parameterized sudo_user (with_items,..) # late processing of parameterized sudo_user (with_items,..)
if self.sudo_user_var is not None: if self.sudo_user_var is not None:
self.sudo_user = template.template(self.basedir, self.sudo_user_var, inject) self.sudo_user = template.template(self.basedir, self.sudo_user_var, inject)
if self.su_user_var is not None:
self.su_user = template.template(self.basedir, self.su_user_var, inject)
# allow module args to work as a dictionary # allow module args to work as a dictionary
# though it is usually a string # though it is usually a string
@ -629,7 +632,6 @@ class Runner(object):
actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file) actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file)
self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass) self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass)
self.su = inject.get('ansible_su', self.su_pass) self.su = inject.get('ansible_su', self.su_pass)
self.su_user = inject.get('ansible_su_user', self.su_user)
self.su_pass = inject.get('ansible_su_pass', self.su_pass) self.su_pass = inject.get('ansible_su_pass', self.su_pass)
if actual_private_key_file is not None: if actual_private_key_file is not None:

Loading…
Cancel
Save