foo is defined and foo !+ "" or "default-value"

On 01/31/2014 06:46 AM, Stephen Ryan wrote:
Thanks, that will work in the case of foo: "". Before I go about
switching all our templates, is there a way to also make it work in the
case of foo: , i.e. without the empty string defined? Ansible detects
these as None

On Friday, 31 January 2014 12:29:11 UTC, Nick Groenen wrote:

    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.

--
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.

Reply via email to