<p dir="auto">Wow, that issue title is a mouthful, but that's the best description I could come up with.</p>
<p dir="auto">My variable is turned into a string, so when I iterate over it in a template it iterates over the characters (including brackets and quotes).</p>
<p dir="auto">Here's a <a href="https://gist.github.com/gkarekinian/2944f54fe85dbb359a91">Gist with just enough yml to reproduce it</a></p>
<p dir="auto">I'm seeing this behavior on ansible 1.3.2.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">async</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">ansible 2.3.0.0</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">default ansible.cfg file</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">When a task is executed with 'poll: 0' (fire and forget) and the time specified in 'async' expires, the async cache remains and a following 'async_status' task reports that the task is still running, although the process was killed.</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="---

- hosts: localhost
  tasks:
    - command: sleep 100
      async: 10
      poll: 0
      register: myJob

    - command: sleep 20

    - name: wait until playbooks are finished
      async_status:
        jid: &quot;{{ myJob.ansible_job_id }}&quot;
      register: myJob_result

    - debug: var=myJob_result"><pre class="notranslate">---

- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">command</span>: <span class="pl-s">sleep 100</span>
      <span class="pl-ent">async</span>: <span class="pl-c1">10</span>
      <span class="pl-ent">poll</span>: <span class="pl-c1">0</span>
      <span class="pl-ent">register</span>: <span class="pl-s">myJob</span>

    - <span class="pl-ent">command</span>: <span class="pl-s">sleep 20</span>

    - <span class="pl-ent">name</span>: <span class="pl-s">wait until playbooks are finished</span>
      <span class="pl-ent">async_status</span>:
        <span class="pl-ent">jid</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ myJob.ansible_job_id }}<span class="pl-pds">"</span></span>
      <span class="pl-ent">register</span>: <span class="pl-s">myJob_result</span>

    - <span class="pl-ent">debug</span>: <span class="pl-s">var=myJob_result</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">The async_status task should report that the job is not running (like it would be if the job was cleaned up by 'async_status' with 'mode: cleanup'). 'Failed' should not be 0.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************

TASK [command] *************************************************************************************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost] =&gt; {&quot;ansible_job_id&quot;: &quot;964367425822.17508&quot;, &quot;changed&quot;: true, &quot;finished&quot;: 0, &quot;results_file&quot;: &quot;/home/stephan/.ansible_async/964367425822.17508&quot;, &quot;started&quot;: 1}

TASK [command] *************************************************************************************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost] =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;sleep&quot;, &quot;20&quot;], &quot;delta&quot;: &quot;0:00:20.005145&quot;, &quot;end&quot;: &quot;2017-06-13 08:26:51.140481&quot;, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2017-06-13 08:26:31.135336&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stderr_lines&quot;: [], &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: []}

TASK [wait until playbooks are finished] ***********************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] =&gt; {&quot;ansible_job_id&quot;: &quot;964367425822.17508&quot;, &quot;changed&quot;: false, &quot;finished&quot;: 0, &quot;started&quot;: 1}

TASK [debug] ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] =&gt; {
    &quot;changed&quot;: false, 
    &quot;myJob_result&quot;: {
        &quot;ansible_job_id&quot;: &quot;964367425822.17508&quot;, 
        &quot;changed&quot;: false, 
        &quot;finished&quot;: 0, 
        &quot;started&quot;: 1
    }
}

PLAY RECAP *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=2    unreachable=0    failed=0  "><pre class="notranslate"><code class="notranslate">PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************

TASK [command] *************************************************************************************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost] =&gt; {"ansible_job_id": "964367425822.17508", "changed": true, "finished": 0, "results_file": "/home/stephan/.ansible_async/964367425822.17508", "started": 1}

TASK [command] *************************************************************************************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost] =&gt; {"changed": true, "cmd": ["sleep", "20"], "delta": "0:00:20.005145", "end": "2017-06-13 08:26:51.140481", "rc": 0, "start": "2017-06-13 08:26:31.135336", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

TASK [wait until playbooks are finished] ***********************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] =&gt; {"ansible_job_id": "964367425822.17508", "changed": false, "finished": 0, "started": 1}

TASK [debug] ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] =&gt; {
    "changed": false, 
    "myJob_result": {
        "ansible_job_id": "964367425822.17508", 
        "changed": false, 
        "finished": 0, 
        "started": 1
    }
}

PLAY RECAP *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=2    unreachable=0    failed=0  
</code></pre></div>