title: When condition is just skipping
body: <p>I have an Ansible playbook as shown below. The only problem is every time I run it is just skipping/ignoring the task.</p>
  
  <p>Can you please help me figure out what is the problem?</p>
  
  <hr>
  
  <pre><code>- name: Register Host to Dynamic Inventory
    hosts: localhost
    gather_facts: false
    tasks:
      - add_host:
          name: "{{ myhost }}"
  
  - name: Enabling the services
    hosts: "{{ myhost }}"
    gather_facts: true
    tasks:
      - name: Make the service available persistently after a reboot for  SLES11
        command: systemctl enable after.local
        with_items: "{{ ansible_distribution_major_version }}"
        when: ansible_distribution_major_version == 11
  
      - name: Make the service available persistently after a reboot for  SLES12
        command: systemctl enable after.local
        with_items: "{{ ansible_distributioni_major_version }}"
        when: ansible_distribution_major_version == 12
  </code></pre>
  
  
  
  <pre><code>TASK [add_host] ****************************************************************03:22:06
  changed: [localhost]
  PLAY [Enabling the services] ***************************************************03:22:06
  TASK [Gathering Facts] *********************************************************03:22:06
  ok: [hostname]
  TASK [Make the service available persistently after a reboot for  SLES11] ******03:22:10
  skipping: [hostname] =&gt; (item=12) 
  TASK [Make the service available persistently after a reboot for  SLES12] ******03:22:10
  skipping: [hostname]
  </code></pre>