ansible: when condition with var from include
<p>With ansible 1.9.2 I have a role with::</p>

<pre><code>- include: snippet.yml repo=rep1
- include: snippet.yml repo=rep2
- include: snippet.yml repo=rep2
</code></pre>

<p>in <code>snippet.yml</code> I have::</p>

<pre><code>- name: debug
  debug: msg='hello'
  when: rep1 == {{ repo }}
</code></pre>

<p>But I get this error message::</p>

<pre><code>fatal: [vagrant] =&gt; error while evaluating conditional: rep1 == rep1

FATAL: all hosts have already failed -- aborting
</code></pre>

<p>When I use the fist syntax proposed by @arbabnazar::</p>

<pre><code>- name: debug
  debug: msg='hello'
  when: "rep1 == {{ repo }}"
</code></pre>

<p>I get this error::</p>

<pre><code>TASK: [stack | debug] *******************************************
fatal: [vagrant] =&gt; error while evaluating conditional: rep1 == rep1

FATAL: all hosts have already failed -- aborting
</code></pre>

<p>With the second syntax proposed by @arbabnazar::</p>

<pre><code>- name: debug
  debug: msg='hello'
  when: "rep1 in {{ repo }}"
</code></pre>

<p>I get this error::</p>

<pre><code>TASK: [stack | debug] *******************************************
fatal: [vagrant] =&gt; error while evaluating conditional: rep1 in rep1

FATAL: all hosts have already failed -- aborting
</code></pre>