mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -07:00
Use the delegated host's interpreters
This commit is contained in:
parent
f2a7ca9a36
commit
13a422261b
1 changed files with 10 additions and 0 deletions
|
@ -373,10 +373,20 @@ 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)
|
||||||
|
inject = inject.copy()
|
||||||
|
interpreters = []
|
||||||
|
for i in inject:
|
||||||
|
if i.startswith("ansible_") and i.endswith("_interpreter"):
|
||||||
|
interpreters.append(i)
|
||||||
|
for i in interpreters:
|
||||||
|
del inject[i]
|
||||||
try:
|
try:
|
||||||
delegate_info = inject['hostvars'][delegate_to]
|
delegate_info = inject['hostvars'][delegate_to]
|
||||||
actual_host = delegate_info.get('ansible_ssh_host', delegate_to)
|
actual_host = delegate_info.get('ansible_ssh_host', delegate_to)
|
||||||
actual_port = delegate_info.get('ansible_ssh_port', port)
|
actual_port = delegate_info.get('ansible_ssh_port', port)
|
||||||
|
for i in delegate_info:
|
||||||
|
if i.startswith("ansible_") and i.endswith("_interpreter"):
|
||||||
|
inject[i] = delegate_info[i]
|
||||||
except errors.AnsibleError:
|
except errors.AnsibleError:
|
||||||
actual_host = delegate_to
|
actual_host = delegate_to
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue