<h5 dir="auto">Issue Type:</h5>

<ul dir="auto">
<li>Bug Report</li>
<li>Feature Idea</li>
<li>Documentation Report</li>
</ul>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;!--- Paste verbatim output from “ansible --version” here --&gt;"><pre class="notranslate"><code class="notranslate">&lt;!--- Paste verbatim output from “ansible --version” here --&gt;
</code></pre></div>
<h5 dir="auto">Ansible Configuration:</h5>

<h5 dir="auto">Environment:</h5>

<h5 dir="auto">Summary:</h5>

<h5 dir="auto">Steps To Reproduce:</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;!--- Paste example playbooks or commands here --&gt;"><pre class="notranslate"><code class="notranslate">&lt;!--- Paste example playbooks or commands here --&gt;
</code></pre></div>

<h5 dir="auto">Expected Results:</h5>

<h5 dir="auto">Actual Results:</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;!--- Paste verbatim command output here --&gt;"><pre class="notranslate"><code class="notranslate">&lt;!--- Paste verbatim command output here --&gt;
</code></pre></div>
<h5 dir="auto">Issue Type:</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.0.0.2
  config file = /usr/local/etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.0.0.2
  config file = /usr/local/etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Ansible Installed on OSX and manage Amazon Linux</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Ansible is unable to use variables in <a href="http://docs.ansible.com/ansible/playbooks_conditionals.html#register-variables" rel="nofollow">register</a></p>
<h5 dir="auto">Steps To Reproduce:</h5>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    ### WORKS
        - wait_for: host=0.0.0.0 port={{ item.port }}
          ignore_errors: true
          register: nginx
          with_items:
            - { name: 'nginx',    port: '80' }

        - debug: var=nginx


    ### DOES NOT WORKS
        - wait_for: host=0.0.0.0 port={{ item.port }}
          ignore_errors: true
          register: &quot;{{ item.name }}&quot;
          with_items:
            - { name: 'nginx1',    port: '80' }

        - debug: var=nginx1
"><pre class="notranslate">    <span class="pl-c"><span class="pl-c">#</span>## WORKS</span>
        - <span class="pl-ent">wait_for</span>: <span class="pl-s">host=0.0.0.0 port={{ item.port }}</span>
          <span class="pl-ent">ignore_errors</span>: <span class="pl-c1">true</span>
          <span class="pl-ent">register</span>: <span class="pl-s">nginx</span>
          <span class="pl-ent">with_items</span>:
            - <span class="pl-s">{ name: 'nginx',    port: '80' }</span>

        - <span class="pl-ent">debug</span>: <span class="pl-s">var=nginx</span>


    <span class="pl-c"><span class="pl-c">#</span>## DOES NOT WORKS</span>
        - <span class="pl-ent">wait_for</span>: <span class="pl-s">host=0.0.0.0 port={{ item.port }}</span>
          <span class="pl-ent">ignore_errors</span>: <span class="pl-c1">true</span>
          <span class="pl-ent">register</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ item.name }}<span class="pl-pds">"</span></span>
          <span class="pl-ent">with_items</span>:
            - <span class="pl-s">{ name: 'nginx1',    port: '80' }</span>

        - <span class="pl-ent">debug</span>: <span class="pl-s">var=nginx1</span>
</pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">Variable <code class="notranslate">nginx1</code> should have been interpolated in <code class="notranslate">register</code></p>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    ## Error in play
    TASK [debug] *******************************************************************
    ok: [my_server] =&gt; {
        &quot;nginx1&quot;: &quot;VARIABLE IS NOT DEFINED!&quot;
    }"><pre class="notranslate"><code class="notranslate">    ## Error in play
    TASK [debug] *******************************************************************
    ok: [my_server] =&gt; {
        "nginx1": "VARIABLE IS NOT DEFINED!"
    }
</code></pre></div>