Merge pull request #5651 from nikut/sshfix

allow ansible_ssh_private_key_file to be templated (thanks to benno)
This commit is contained in:
jctanner 2014-02-24 14:26:48 -05:00
commit 93c746db9c
2 changed files with 3 additions and 0 deletions

View file

@ -718,6 +718,7 @@ class Runner(object):
actual_pass = inject.get('ansible_ssh_pass', self.remote_pass) actual_pass = inject.get('ansible_ssh_pass', self.remote_pass)
actual_transport = inject.get('ansible_connection', self.transport) actual_transport = inject.get('ansible_connection', self.transport)
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)
actual_private_key_file = template.template(self.basedir, actual_private_key_file, inject, fail_on_undefined=True)
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) self.su = inject.get('ansible_su', self.su)
self.su_pass = inject.get('ansible_su_pass', self.su_pass) self.su_pass = inject.get('ansible_su_pass', self.su_pass)

View file

@ -135,6 +135,8 @@ class ActionModule(object):
else: else:
private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file) private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file)
private_key = template.template(self.runner.basedir, private_key, inject, fail_on_undefined=True)
if not private_key is None: if not private_key is None:
private_key = os.path.expanduser(private_key) private_key = os.path.expanduser(private_key)
options['private_key'] = private_key options['private_key'] = private_key