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?
eg.
vars file:
my_data_array: [ "valueA", "valueB", "valueC" ]
template section example:
{% if ("valueA" in my_data_array) %}
<templateinformation>
{% endif %}
I've also tried (both with and without brackets):
{% if ("valueA" in my_data_array) %}
and:
{% if {{ "valueA" in my_data_array }} %}
*(update) and:
{% "valueA" in my_data_array %}
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 in_array() function, or Python's in 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.
Am I doing something wrong or is this unsupported and I'll have to setup a loop?