<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 2.0.0.2<br>
ansible 2.1.0 (devel <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/7e3963420dd8258aacb2b6d617f786185a0ef74a/hovercard" href="https://github.com/ansible/ansible/commit/7e3963420dd8258aacb2b6d617f786185a0ef74a"><tt>7e39634</tt></a>)</p>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Ubuntu 15.10</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Ansible 2.0 added a feature to use <em>include</em> statements together with <em>with_items</em> loops. When nesting <em>include</em> statements, (i.e. file <em>A.yml</em> includes <em>B.yml</em>, which includes <em>C.yml</em>) the <em>item</em> variable is not set properly, i.e. the inner <em>include</em> + <em>with_items</em> loop does not override the <em>item</em> value from the outer loop.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto"><em>main.yml</em></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
---
- include: include_outer.yml
  with_items:
    - 1
    - 2
    - 3"><pre class="notranslate">---
- <span class="pl-ent">include</span>: <span class="pl-s">include_outer.yml</span>
  <span class="pl-ent">with_items</span>:
    - <span class="pl-c1">1</span>
    - <span class="pl-c1">2</span>
    - <span class="pl-c1">3</span></pre></div>
<p dir="auto"><em>include_outer.yml</em></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
---
- debug:
    msg: &quot;Outer include: item={{ item }}&quot;

- include: include_inner.yml
  with_items:
    - A
    - B
    - C"><pre class="notranslate">---
- <span class="pl-ent">debug</span>:
    <span class="pl-ent">msg</span>: <span class="pl-s"><span class="pl-pds">"</span>Outer include: item={{ item }}<span class="pl-pds">"</span></span>

- <span class="pl-ent">include</span>: <span class="pl-s">include_inner.yml</span>
  <span class="pl-ent">with_items</span>:
    - <span class="pl-s">A</span>
    - <span class="pl-s">B</span>
    - <span class="pl-s">C</span></pre></div>
<p dir="auto"><em>include_inner.yml</em></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
---
- debug:
    msg: &quot;Inner include: item={{ item }}&quot;"><pre class="notranslate">---
- <span class="pl-ent">debug</span>:
    <span class="pl-ent">msg</span>: <span class="pl-s"><span class="pl-pds">"</span>Inner include: item={{ item }}<span class="pl-pds">"</span></span></pre></div>
<h5 dir="auto">Expected Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;msg&quot;: &quot;Outer include: item=1&quot;
&quot;msg&quot;: &quot;Inner include: item=A&quot;
&quot;msg&quot;: &quot;Inner include: item=B&quot;
&quot;msg&quot;: &quot;Inner include: item=C&quot;
&quot;msg&quot;: &quot;Outer include: item=2&quot;
&quot;msg&quot;: &quot;Inner include: item=A&quot;
&quot;msg&quot;: &quot;Inner include: item=B&quot;
&quot;msg&quot;: &quot;Inner include: item=C&quot;
&quot;msg&quot;: &quot;Outer include: item=3&quot;
&quot;msg&quot;: &quot;Inner include: item=A&quot;
&quot;msg&quot;: &quot;Inner include: item=B&quot;
&quot;msg&quot;: &quot;Inner include: item=C&quot;"><pre class="notranslate"><code class="notranslate">"msg": "Outer include: item=1"
"msg": "Inner include: item=A"
"msg": "Inner include: item=B"
"msg": "Inner include: item=C"
"msg": "Outer include: item=2"
"msg": "Inner include: item=A"
"msg": "Inner include: item=B"
"msg": "Inner include: item=C"
"msg": "Outer include: item=3"
"msg": "Inner include: item=A"
"msg": "Inner include: item=B"
"msg": "Inner include: item=C"
</code></pre></div>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;msg&quot;: &quot;Outer include: item=1&quot;
&quot;msg&quot;: &quot;Inner include: item=1&quot;
&quot;msg&quot;: &quot;Inner include: item=1&quot;
&quot;msg&quot;: &quot;Inner include: item=1&quot;
&quot;msg&quot;: &quot;Outer include: item=2&quot;
&quot;msg&quot;: &quot;Inner include: item=2&quot;
&quot;msg&quot;: &quot;Inner include: item=2&quot;
&quot;msg&quot;: &quot;Inner include: item=2&quot;
&quot;msg&quot;: &quot;Outer include: item=3&quot;
&quot;msg&quot;: &quot;Inner include: item=3&quot;
&quot;msg&quot;: &quot;Inner include: item=3&quot;
&quot;msg&quot;: &quot;Inner include: item=3&quot;"><pre class="notranslate"><code class="notranslate">"msg": "Outer include: item=1"
"msg": "Inner include: item=1"
"msg": "Inner include: item=1"
"msg": "Inner include: item=1"
"msg": "Outer include: item=2"
"msg": "Inner include: item=2"
"msg": "Inner include: item=2"
"msg": "Inner include: item=2"
"msg": "Outer include: item=3"
"msg": "Inner include: item=3"
"msg": "Inner include: item=3"
"msg": "Inner include: item=3"
</code></pre></div>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Feature Idea</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">1.8</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Please summarize your request in this space.  You will earn bonus points for being succinct, but please add enough detail so we can understand the request.  Thanks!</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">If this is a bug ticket, please enter the steps you use to reproduce the problem in the space below.  If this is a feature request, please enter the steps you would use to use the feature.  If an example playbook is useful, please include a short reproducer inline, indented by four spaces.  If a longer one is necessary, linking to one uploaded to gist.github.com would be great.  Much appreciated!</p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">Docker 1.2 now lets you specify a restart policy (see here: <a href="https://blog.docker.com/2014/08/announcing-docker-1-2-0/" rel="nofollow">https://blog.docker.com/2014/08/announcing-docker-1-2-0/</a>). It should be configurable using the docker module in 1.8.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">Cannot configure the restart policy using ansible.</p>