I want to run few tasks in shell if they satisfy a condition. Strangely the task runs if the second condition is satisfied even though the first one fails.
name: ods
shell: “/something {{state}}”
when: ((ods) and (not (ansible_hostname | search(“demlh*”))))
register: sss_ods_out
notify: output ods
ignore_errors: yes
Here sss_ods is a variable defined in a vars file. If I remove the latter condition the task would run but I want both the conditions to be satisfied for the task to run and I can’t understand where am I going wrong.