When clause with AND and OR condition does not work

Yes, it’s supported. The complete snippet of the task from @flowerysong works as expected.

To test conditionals, for example, the debug task like following is quite clear and helpful to understand how conditionals works.

- debug:
    var: conditionals
  vars:
    conditionals:
      01_websrv: '{{ "websrv" in var_etchosts.stdout }}'
      02_nfsserv1: '{{ "nfsserv1" in var_applications.stdout }}'
      03_192_168_2_100: '{{ "192.168.2.100" in var_applications.stdout }}'
      04_or: '{{ "nfsserv1" in var_applications.stdout or "192.168.2.100" in var_applications.stdout }}'
TASK [debug] ************************************************************
ok: [localhost] => {
    "conditionals": {
        "01_websrv": true,
        "02_nfsserv1": true,
        "03_192_168_2_100": false,
        "04_or": true
    }
}
2 Likes