title: Run Ansible task on SUSE machines only
body: <p>I want to execute my Ansible task only on a specific SUSE version. But this task gets executed for all Linux OS flavors. Which is not expected. Can someone help me with this? Why is the when condition not working? What I am doing wrong?</p>
  
  <p>Code:</p>
  
  <pre><code># Action 146: addlink ld-lsb.so.3-&gt;ld-2.11.1.so in /lib on sles11.x,12.x for lmutil in cct2000739233
    - name: Addlink ld-lsb.so.3-&gt;ld-2.11.1.so in /lib on sles11.x,12.x for lmutil
      shell: "ls ld-*.so|grep -v lsb|head -n 1"
      args:
        chdir: /lib
      register: ldso
  
    - stat:
        path: /lib64/ld-lsb-x86-64.so.3
      register: lib64_result
  
    - stat:
        path: /lib/ld-lsb.so.3
      register: lib_result
  
    - block:
        - file:
            src: "/lib/{{ ldso.stdout }}"
            dest: /lib/ld-lsb.so.3
            state: link
            force: true
        - file:
            src: /lib64/ld-linux-x86-64.so.2
            dest: /lib64/ld-lsb-x86-64.so.3
            state: link
            force: true
      when:
        # Check the OS level. Make sure it runs only on SLES-11 SP4,SLES-12SP0/1/2/3
        - ansible_distribution == 'Suse'
        - ansible_distribution_major_version == "11"
        - ansible_distribution_release == "4"
        - ansible_distribution_version == "11.4"
  
        - ansible_distribution == 'SLES'
        - ansible_distribution_major_version == "12"
        - ansible_distribution_release == "0" or "1" or "2" or "3"
        - ansible_distribution_version == "12.0" or "12.1" or "12.2" or "12.3"
  
        - not lib64_result.stat.exists|bool or not lib_result.stat.exists|bool
        - ldso.stdout != ''
  
    - debug:
        msg: "{{ ldso.stdout }}"
  </code></pre>