If setting it to an empty string when you don't want it to run is okay for your use case, you could do:
when: foo|default("") != "" That will compare against the value of foo when it's defined, and otherwise compare against an empty string. -- Nick Groenen | zoni | @NickGroenen https://zoni.nl | GnuPG/GPG key ID: 0xAB5382F6 -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.