title: Jinja2 template does value exist in array?
body: <p>Is there a way while using templating in ansible to see if a value exists in an array without using a loop to go through the array?</p>
  
  <p>eg.</p>
  
  <p>vars file:</p>
  
  <pre><code>my_data_array: [ "valueA", "valueB", "valueC" ]
  </code></pre>
  
  <p>template section example:</p>
  
  <pre><code>{% if ("valueA" in my_data_array) %}
  &lt;templateinformation&gt;
  {% endif %}
  </code></pre>
  
  <p>I've also tried (both with and without brackets):</p>
  
  <pre><code>{% if ("valueA" in my_data_array) %}
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>{% if {{ "valueA" in my_data_array }} %}
  </code></pre>
  
  <p>*(<strong>update</strong>) and:</p>
  
  <pre><code>{% "valueA" in my_data_array %}
  </code></pre>
  
  <p>and a couple of others now as well. Most come back with syntax errors.  What I am looking for is something similar to PHP's <strong>in_array()</strong> function, or Python's <strong>in</strong> command where it returns a boolean if the value is in the array.  The ansible jinja2 support seems to include it only if it is a string within a string.</p>
  
  <p>Am I doing something wrong or is this unsupported and I'll have to setup a loop?</p>