<p dir="auto">AFAICT it's impossible to use a <strong>variable</strong> for <em>ignore_errors</em></p>
<h3 dir="auto">Given</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="vars:
    ignore_err: no"><pre class="notranslate"><code class="notranslate">vars:
    ignore_err: no
</code></pre></div>
<h3 dir="auto">Solution Attempts</h3>
<p dir="auto">Interpreted as a string, so always true:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ignore_errors: $ignore_err"><pre class="notranslate"><code class="notranslate">ignore_errors: $ignore_err
</code></pre></div>
<p dir="auto">Dito:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ignore_errors: {{ ignore_err }}"><pre class="notranslate"><code class="notranslate">ignore_errors: {{ ignore_err }}
</code></pre></div>
<p dir="auto">Illegal YAML syntax:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ignore_errors: {{ ignore_err | bool }}"><pre class="notranslate"><code class="notranslate">ignore_errors: {{ ignore_err | bool }}
</code></pre></div>
<p dir="auto">String again...:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ignore_errors: &quot;{{ ignore_err | bool }}&quot;"><pre class="notranslate"><code class="notranslate">ignore_errors: "{{ ignore_err | bool }}"
</code></pre></div>
<p dir="auto">Maybe I'm stupid, but I can't see how to do this. I had to duplicate the task with one ignore_errors: yes and one no and control it with a when...</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Documentation Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">core documentation</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">ansible 2.1.1.0 (stable-2.1 <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/8659f255df742072bc8a5bc3a307a2ba3153f175/hovercard" href="https://github.com/ansible/ansible/commit/8659f255df742072bc8a5bc3a307a2ba3153f175"><tt>8659f25</tt></a>) last updated 2016/07/03 12:49:58 (GMT +200)<br>
lib/ansible/modules/core: (stable-2.1 dc15456874) last updated 2016/07/03 12:49:49 (GMT +200)<br>
lib/ansible/modules/extras: (stable-2.1 <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/377f911867c63bdfa5e0fd70b273b1c67a3be212/hovercard" href="https://github.com/ansible/ansible/commit/377f911867c63bdfa5e0fd70b273b1c67a3be212"><tt>377f911</tt></a>) last updated 2016/07/03 12:49:49 (GMT +200)<br>
config file =<br>
configured module search path = Default w/o overrides</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">no changes</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Ansible host: Debian 8.5<br>
managed host: Debian 8.5</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The documentation at <a href="http://docs.ansible.com/ansible/playbooks_roles.html#role-dependencies" rel="nofollow">http://docs.ansible.com/ansible/playbooks_roles.html#role-dependencies</a> is misleading and incorrect. First, it should be mentioned, that roles are executed multiple times if they have different parameters, regardless of the allow_duplicates setting. Second, in the example, the allow_duplicates is in the wrong meta file because it has to be specified in the role that has to be executed multiple times (in this case brake and tire).</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# site.yml

---
- name: sample
  hosts: server
  roles:
    - car

# roles/car/meta/main.yml

---
dependencies:
  - { role: wheel, n: 1 }
  - { role: wheel, n: 2 }
  - { role: wheel, n: 3 }
  - { role: wheel, n: 4 }

# roles/car/tasks/main.yml

---
- debug:
    msg: &quot;in role CAR&quot;

# roles/wheel/meta/main.yml

---
dependencies:
  - { role: tire }
  - { role: brake }

# roles/wheel/tasks/main.yml

---
- debug:
    msg: &quot;in role WHEEL (n={{ n }})&quot;


# roles/tire/meta/main.yml

---
allow_duplicates: no

# roles/tire/tasks/main.yml

---
- debug:
    msg: &quot;in role TIRE (n={{ n }})&quot;

# roles/brake/meta/main.yml

---
allow_duplicates: yes

# roles/brake/tasks/main.yml

---
- debug:
    msg: &quot;in role BRAKE (n={{ n }})&quot;"><pre class="notranslate"><code class="notranslate"># site.yml

---
- name: sample
  hosts: server
  roles:
    - car

# roles/car/meta/main.yml

---
dependencies:
  - { role: wheel, n: 1 }
  - { role: wheel, n: 2 }
  - { role: wheel, n: 3 }
  - { role: wheel, n: 4 }

# roles/car/tasks/main.yml

---
- debug:
    msg: "in role CAR"

# roles/wheel/meta/main.yml

---
dependencies:
  - { role: tire }
  - { role: brake }

# roles/wheel/tasks/main.yml

---
- debug:
    msg: "in role WHEEL (n={{ n }})"


# roles/tire/meta/main.yml

---
allow_duplicates: no

# roles/tire/tasks/main.yml

---
- debug:
    msg: "in role TIRE (n={{ n }})"

# roles/brake/meta/main.yml

---
allow_duplicates: yes

# roles/brake/tasks/main.yml

---
- debug:
    msg: "in role BRAKE (n={{ n }})"
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">With the above configuration, role 'brake' is executed multiple times, while 'tire' is not.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [tire : debug] ************************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role TIRE (n=1)&quot;
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role BRAKE (n=1)&quot;
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role WHEEL (n=1)&quot;
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role BRAKE (n=2)&quot;
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role WHEEL (n=2)&quot;
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role BRAKE (n=3)&quot;
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role WHEEL (n=3)&quot;
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role BRAKE (n=4)&quot;
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role WHEEL (n=4)&quot;
}

TASK [car : debug] *************************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;in role CAR&quot;
}"><pre class="notranslate"><code class="notranslate">TASK [tire : debug] ************************************************************
ok: [localhost] =&gt; {
    "msg": "in role TIRE (n=1)"
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role BRAKE (n=1)"
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role WHEEL (n=1)"
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role BRAKE (n=2)"
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role WHEEL (n=2)"
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role BRAKE (n=3)"
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role WHEEL (n=3)"
}

TASK [brake : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role BRAKE (n=4)"
}

TASK [wheel : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "in role WHEEL (n=4)"
}

TASK [car : debug] *************************************************************
ok: [localhost] =&gt; {
    "msg": "in role CAR"
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">The actual result matches the expected one, because only the documentation is incorrect.</p>