Checking for multiple conditions using “when” on single task in ansible


I want to evaluate multiple condition in ansible using when, here is my playbook:

here is my var file for reference:

When I try to execute this playbook, I am getting this error:

Can somebody point me out that how we can use multiple conditions with ansible on single task.



You can use like this.

Link to official docs: The When Statement.

Also Please refer to this gist:

Leave a Reply