There's a high likelihood that their type is actually 'string' instead of
boolean, try
- debug: msg="{{ (_consul_install_agent | bool) and (consult_use_dnsmasq |
bool) }}"
On Friday, 17 July 2015 06:23:33 UTC+1, Barry Kaplan wrote:
>
> I have:
>
> - debug: var=_consul_install_agent
> - debug: var=consul_use_dnsmasq
> - debug: msg="{{_consul_install_agent and consul_use_dnsmasq}}"
>
>
> The two variables are true and false respectively, but the expression
> evaluates to true?
>
>
> TASK: [consul | debug var=_consul_install_agent]
> ******************************
> ok: [10.0.196.112] => {
> "var": {
> "_consul_install_agent": "False"
> }
> }
>
>
> TASK: [consul | debug var=consul_use_dnsmasq]
> *********************************
> ok: [10.0.196.112] => {
> "var": {
> "consul_use_dnsmasq": "True"
> }
> }
>
>
> TASK: [consul | debug msg="{{_consul_install_agent and
> consul_use_dnsmasq}}"] ***
> ok: [10.0.196.112] => {
> "msg": "True"
> }
>
>
> But if the expression is
>
> - debug: msg="{{_consul_install_agent == true and consul_use_dnsmasq ==
> true}}"
>
> Then it evals to false.
>
> Is this expected with jinja? Without the 'and' the '== true' seems not
> necessary.
>
--
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/8b16891e-c797-41b0-91ad-8835d3862422%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.