title: How to check whether an item is present in an Ansible array?
body: <p>Let's say I have the following example, storing all <code>git config</code> values in an Ansible variable:</p>
  
  <pre><code>- shell: git config --global --list
    register: git_config_list
  </code></pre>
  
  <p>Ansible stores the result of this command in the <code>git_config_list</code> variable, and one of the items is <code>stdout_lines</code>, containing the output of the command in an array of entries, e.g.</p>
  
  <pre><code>[
  "user.name=Foo Bar",
  "user.email=foo@example.com"
  ]
  </code></pre>
  
  <p>How can I check whether a certain value is already set, e.g. for verifying that <code>user.name</code> has a value?</p>
  
  <p>Is there a way to call something like <code>contains</code> on the array, combined with a regular expression, allowing me to find the value I'm looking for? Or do I have to loop over the <code>stdout_lines</code> entries to find what I'm looking for?</p>
  
  <p>An example on how to do something like this would be appreciated.</p>