title: ansible: check if one of array elements is in variable string
body: <p>I've got a list in ansible:</p>
  <pre><code>ssh_port_patterns: [
    &quot;domain.tld&quot;,
    &quot;example.tld&quot;,
    &quot;something.tld&quot;
  ]
  </code></pre>
  <p>and I'd like to run one task, only if its inventory_hostname will containt one of these items phrase. For example task should be run when inventory_hostname will be set to: <code>extra.domain.tld</code>, but shouldn't in case of <code>something.else.tld</code></p>
  <p>Is it possible to make such check with ansible?</p>