Ansible Multiple Conditions Using when ons Single Task.md
There are a lot of ways on doing it. One of it is as follows:
1tasks:
2 - name: "shut down CentOS 6 and Debian 7 systems"
3 command: /sbin/shutdown -t now
4 when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "6") or
5 (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] == "7")
Read further in Ansible Official Docs.