Morgan,
Thanks a lot, passing true to the 'default' did the trick. It works now!!
Working statement...
project_id: "{{ lookup('env','PROJECT_ID') | default('FOO_PROJECT',true) }}"
For Question B:
In when statement, which is preferred
when: flag is defined and flag == 'False'
Or
when: flag is defined and flag == False
Are the equivalent in ansible?
Thanks.
Yasir.
On Friday, July 18, 2014 9:47:42 AM UTC-4, C. Morgan Hamill wrote:
>
> Excerpts from Michael DeHaan's message of 2014-07-18 09:21:53 -0400:
> > The lookup plugin will return empty string, not None, if that env is not
> > found.
> >
> > However that is still False in Python. That's curious and may be
> related
> > to how "default" is implemented. Will have to try that.
>
> Jinja's `default` filter will, by default, only use the value passed to
> to it if the variable in question is undefined, like, fo' real.
>
> If you want to use the default value whenever the variable is False in
> a boolean context, then use:
>
> my_variable|default("my_default", true)
>
> Check it out: http://jinja.pocoo.org/docs/templates/#builtin-filters
> --
> Morgan Hamill
>
--
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/e807280a-3d9f-43db-aece-d601c4e04d9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.