title: Ansible. When for exact string only
body: <p>Launching next command I can get all installed schemas:</p>
  
  <pre><code># fusiondirectory-insert-schema -l
  core
  cosine
  nis
  inetorgperson
  core-fd
  core-fd-conf
  ldapns
  template-fd
  openssh-lpk
  </code></pre>
  
  <p>If some schema is missed I can install it by command:</p>
  
  <pre><code># fusiondirectory-insert-schema -i mail-fd-conf.schema
  </code></pre>
  
  <p>So in Ansible using <code>shell</code> module I can get all installed schemas into variable:</p>
  
  <pre><code>- name: Get info which schemas are enabled
    shell: fusiondirectory-insert-schema -l
    register: fusiondirectory_schemas
  </code></pre>
  
  <p>And then analyze this output and install skipped schema:</p>
  
  <pre><code>- name: Apply mail schemas for Fusiondirectory
    shell: fusiondirectory-insert-schema -i mail-fd-conf.schema
    when: ('mail-fd-conf' not in fusiondirectory_schemas.stdout)
    args:
      chdir: "/etc/ldap/schema/fusiondirectory/"
  </code></pre>
  
  <p>Let's suppose I wish to install few different schemas and use only one <code>fusiondirectory_schemas.stdout</code> output for <code>when</code>. So my question is how to use in <code>when</code> argument regex like <code>^mail-fd-conf$</code> (but no <code>mail-fd-conf-something</code> or <code>test-mail-fd-conf</code>) because I want only exact overlap.</p>