How to run a task when variable is undefined in ansible?


I am looking for a way to perform a task when ansible variable is not registers /undefined e.g


From the ansible docs:
If a required variable has not been set, you can skip or fail using Jinja2’s defined test. For example:

So in your case, when: deployed_revision is not defined should work

Leave a Reply