Run an Ansible task only when the variable contains a specific string
<p>I have multiple tasks depend from the value of variable1. I want to check if the value is in <code>{{ variable1 }}</code> but I get an error:</p>
<pre class="lang-yaml prettyprint-override"><code>- name: do something when the value in variable1
  command: &lt;command&gt;
  when: &quot;'value' in {{ variable1 }}&quot;
</code></pre>
<p>I'm using ansible 2.0.2</p>