1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use the delegated host's interpreters

This commit is contained in:
Daniel Hokka Zakrisson 2012-10-25 13:59:24 +02:00
parent f2a7ca9a36
commit 13a422261b

View file

@ -373,10 +373,20 @@ class Runner(object):
delegate_to = inject.get('delegate_to', None)
if delegate_to is not None:
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:
delegate_info = inject['hostvars'][delegate_to]
actual_host = delegate_info.get('ansible_ssh_host', delegate_to)
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:
actual_host = delegate_to