mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add an ansible_ssh_host inventory variable
This commit is contained in:
parent
b8c4bb9e6e
commit
8d97bb4f8e
1 changed files with 5 additions and 2 deletions
|
@ -343,10 +343,13 @@ class Runner(object):
|
||||||
actual_host = host
|
actual_host = host
|
||||||
try:
|
try:
|
||||||
delegate_to = inject.get('delegate_to', None)
|
delegate_to = inject.get('delegate_to', None)
|
||||||
|
alternative_host = inject.get('ansible_ssh_host', None)
|
||||||
if delegate_to is not None:
|
if delegate_to is not None:
|
||||||
actual_host = delegate_to
|
actual_host = delegate_to
|
||||||
|
elif alternative_host is not None:
|
||||||
|
actual_host = alternative_host
|
||||||
conn = self.connector.connect(actual_host, port)
|
conn = self.connector.connect(actual_host, port)
|
||||||
if delegate_to is not None:
|
if delegate_to is not None or alternative_host is not None:
|
||||||
conn._delegate_for = host
|
conn._delegate_for = host
|
||||||
except errors.AnsibleConnectionFailed, e:
|
except errors.AnsibleConnectionFailed, e:
|
||||||
result = dict(failed=True, msg="FAILED: %s" % str(e))
|
result = dict(failed=True, msg="FAILED: %s" % str(e))
|
||||||
|
|
Loading…
Reference in a new issue