You're a hero! Splitting does the job. I still wonder why previous logic 
did not work.

On Sunday, 27 May 2018 21:21:15 UTC+5:30, Pranay Nanda wrote:
>
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/801d7920-39c0-40a1-a173-2c4cabf7db34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to