title: group_names variable in When conditional problem
body: <p>Am working on an ansible Playbook. Before the playbook there is a selection of the group that will used.</p>
  <p>My problem is the When conditional with the group_names ansible variable, used together i get the output:</p>
  <pre><code>TASK [task in group1] *****************************************************
  16:28:58
    fatal: [server1]: FAILED! =&gt; {&quot;msg&quot;: &quot;The conditional check 'group_names == group1' failed. The error was: error while evaluating conditional (group_names == group1): 'group1' is undefined\n\nThe error appears to be in '/home/directory/ansible/tasks/my_playbook.yml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: task in group1\n      ^ here\n&quot;}
  </code></pre>
  <p>this is my playbook:</p>
  <pre><code>---
  
  - name: &quot;playbook name&quot;
    hosts: group1:group2:group3
   
  
    tasks:
      - name: task 1
        command:  echo &quot;first task&quot;
       
      - name: task in group1
        command: echo &quot;group1&quot;
        when:  group_names == group1
  
      - name: task in group2
        command: echo &quot;group2&quot;
        when:  group_names == group2
  
      - name: task in group3
        command: echo &quot;group3&quot;
        when:  group_names == group3
       
  </code></pre>
  <p>My host.ini file</p>
  <pre><code>[group1]
  server1
  server2
  server3
  
  [group2]
  server4
  server5
  server6
  
  [group3]
  server7
  server8
  server9
  
  [group1:vars]
  ansible_user=remote
  ansible_password=55h_pa$$w0rd
  ansible_ssh_port=22
  ansible_ssh_user=sshuser
  ansible_ssh_private_key_file=/home/directory/.ssh
  
  [group2:vars]
  ansible_user=remote
  ansible_password=55h_pa$$w0rd
  ansible_ssh_port=22
  ansible_ssh_user=sshuser
  ansible_ssh_private_key_file=/home/directory/.ssh
  
  [group3:vars]
  ansible_user=remote
  ansible_password=55h_pa$$w0rd
  ansible_ssh_port=22
  ansible_ssh_user=sshuser
  ansible_ssh_private_key_file=/home/directory/.ssh
  </code></pre>
  <p>Any idea of what have i done wrong here?</p>