From 98332634172d1b53da2c30985ff2b84a43bb443b Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Thu, 27 Feb 2014 18:06:34 +0100 Subject: [PATCH] Fixes templating of ansible_ssh_host for delegates --- lib/ansible/runner/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index aaf9c8b18c..bb45df0571 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -306,7 +306,7 @@ class Runner(object): delegate = {} - # allow ansible_ssh_host to be templated + # allow delegated host to be templated delegate['host'] = template.template(self.basedir, host, remote_inject, fail_on_undefined=True) @@ -331,7 +331,10 @@ class Runner(object): this_info = {} # get the real ssh_address for the delegate - delegate['ssh_host'] = this_info.get('ansible_ssh_host', delegate['host']) + # and allow ansible_ssh_host to be templated + delegate['ssh_host'] = template.template(self.basedir, + this_info.get('ansible_ssh_host', this_host), + this_info, fail_on_undefined=True) delegate['port'] = this_info.get('ansible_ssh_port', port)