<p dir="auto">ansible 0.8 (devel <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/761330b125d1809fa72cd0ca06a441363ad85847/hovercard" href="https://github.com/ansible/ansible/commit/761330b125d1809fa72cd0ca06a441363ad85847"><tt>761330b</tt></a>) last updated 2012/10/04 10:13:36 (GMT +200)</p>
<p dir="auto">Hello,</p>
<p dir="auto">I have a host in the inventory which uses a non-standard SSH port (in my case: 2222).<br>
If I use delegate_to to delegate to another host, ansible connects to the host (vz112.local) with the port from the host (10.20.20.208) which is processed by the playbook (port 2222 in my case). Of course this fails.</p>
<p dir="auto">It seems I'm not able to override the port via "delegate_to: otherhost:22".</p>
<p dir="auto">Is this a bug, feature or do I something wrong?<br>
(Well, workaround is to use redir on the delegate_to host for now.)</p>
<p dir="auto">Thanks,<br>
Dietmar</p>
<hr>
<p dir="auto">[xxx]<br>
10.20.20.208:2222</p>
<hr>
<ul dir="auto">
<li>name: Create base Nagios host configuration<br>
action: template src=files/etc/nagios/hosts/host.cfg.j2 dest=/etc/nagios/hosts/${ansible_hostname}.cfg<br>
delegate_to: vz112.local</li>
</ul>
<hr>
<p dir="auto">TASK: [Create base Nagios host configuration] *********************<br>
fatal: [10.20.20.208] =&gt; failed to transfer file to /source:</p>
<p dir="auto">Connecting to vz112.local...<br>
ssh: connect to host vz112.local port 2222: Connection refused<br>
Couldn't read packet: Connection reset by peer</p>
<p dir="auto">FATAL: all hosts have already failed -- aborting</p>
<p dir="auto">Thanks to a tip earlier, I'm using <code class="notranslate">ansible_python_interpreter</code> to jiggle with the Python version nodes can use: hosts in my inventory have that variable set accordingly.</p>
<p dir="auto">Installing 0.7 now allows me to use some of the new cool features, but I find certain inconsistencies:</p>
<ol dir="auto">
<li>Jinja2 templates don't use the specified interpreter. The following code complains that <code class="notranslate">simplejson</code> cannot be imported, though the Python-2.7.3 I point to with <code class="notranslate">ansible_python_interpreter</code> can, indeed, <code class="notranslate">import json</code>:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{{ ansible_facts | to_json }}"><pre class="notranslate"><code class="notranslate">{{ ansible_facts | to_json }}
</code></pre></div>
<ol dir="auto">
<li>A Playbook which has a <code class="notranslate">local_action: template src=xx.j2 dest=/tmp/xx</code> uses the default <code class="notranslate">/usr/bin/python</code> on the target system (i.e. <code class="notranslate">127.0.0.1</code>) instead of that configured with <code class="notranslate">ansible_python_interpreter</code>.</li>
</ol>