title: Jinja2 filter list using string contains test
body: <p>I'm trying to filter a list in ansible in Jinja2 when the elements contain a string, but the Jinja documentation doesn't seem clear enough for me to figure it out.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>- name: run script
    command: /usr/tmp/run_script.py
    register: script_results
  
  - name: display run info
    debug:
      var: "{{script_results.stdout_lines | select(\"'running script' in script_results.stdout_lines\") }}"
  </code></pre>
  
  <p>But all I get is the error:</p>
  
  <pre><code>"&lt;generator object _select_or_reject at 0x13851e0&gt;": "VARIABLE IS NOT DEFINED!"
  </code></pre>
  
  <p>So for example, if <code>stdout_lines</code> contains <code>["apples","running script one","oranges","running script two"]</code>, I want to print</p>
  
  <pre><code>running script one
  running script two
  </code></pre>
  
  <p>They have <a href="http://jinja.pocoo.org/docs/dev/templates/#builtin-filters" rel="noreferrer">documentation for select</a> and <a href="http://jinja.pocoo.org/docs/dev/templates/#builtin-tests" rel="noreferrer">documentation for built-in-tests</a>, but they don't display the "in" test, and I don't know how they work in the context of this ansible variable.</p>
  
  <p>I tried solving it like this:</p>
  
  <pre><code>- name: display run info
    debug:
      var: item
    with_items: "{{script_results.stdout_lines}}"
    when: "'running script' in item"
  </code></pre>
  
  <p>But that displays "skipping" for every line that doesn't pass the test ... kinda defeating the purpose!</p>