Commit 4e79835b by Michael DeHaan

Merge pull request #1378 from dhozac/ansible_ssh-fixes

Fixes for ansible_ssh_host and ansible_ssh_port
parents 6aafb42f 6701726b
...@@ -391,13 +391,16 @@ class Runner(object): ...@@ -391,13 +391,16 @@ class Runner(object):
delegate_to = inject.get('delegate_to', None) delegate_to = inject.get('delegate_to', None)
if delegate_to is not None: if delegate_to is not None:
delegate_to = utils.template(self.basedir, delegate_to, inject) delegate_to = utils.template(self.basedir, delegate_to, inject)
delegate_info = inject['hostvars'][delegate_to] try:
actual_host = delegate_info.get('ansible_ssh_host', delegate_to) delegate_info = inject['hostvars'][delegate_to]
actual_port = delegate_info.get('ansible_ssh_port', port) actual_host = delegate_info.get('ansible_ssh_host', delegate_to)
actual_port = delegate_info.get('ansible_ssh_port', port)
except errors.AnsibleError:
actual_host = delegate_to
try: try:
# connect # connect
conn = self.connector.connect(actual_host, actual_port) conn = self.connector.connect(actual_host, int(actual_port))
if delegate_to: if delegate_to:
conn.delegate = host conn.delegate = host
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment