title: Conditional statements should not include jinja2 templating delimiters such as {{ }} or {{% %}}
body: <p>I searched online and tried all examples but in vain. I am getting the following error &quot;Conditional statements should not include jinja2 templating delimiters such as {{ }} or {{ % %}}</p>
  <p>Appreciate if you could re-write</p>
  <p>Contents of hosts.ini</p>
  <pre><code>[DEVprimaryappservers]
  host1.example.com
     
  [SITprimaryappservers]
  host2.example.com
  </code></pre>
  <p>Playbook has</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: add service Service
    include_vars:
      file: inventory/{{ env }}/group_vars/primarystartservices.yml
  - name: Start Service
    win_service:
      name: &quot;{{ item }}&quot;
      state: started
    loop: &quot;{{ services }}&quot;
    when: &quot;inventory_hostname in groups[~ env 'primaryappservers']&quot;
  </code></pre>
  <p>I had before like below which is when I got conditional statements should not include jinja2 template warning</p>
  <pre class="lang-yaml prettyprint-override"><code>---
  - name: sample code
    win_service:
      state: started
    when: &quot;inventory_hostname in group[{{ env }}'primaryappservers']&quot;
  </code></pre>