On Monday, 19 February 2018 16.52.02 CET ishan jain wrote:
> *include_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
>     - include_tasks: "{{ condition | ternary ('docker1.yaml', 
> 'docker2.yaml') }}"
> 
> *import_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
>     - import_tasks: "{{ condition | ternary ('docker1.yaml', 
> 'docker2.yaml') }}"
> 
> 
> (docker1.yaml prints "msg": "Tasks 1 Host 1" and docker2.yaml prints "msg": 
> "Tasks 2 Host 2")
> 
> 
> No matter how i execute this, it always includes/import docker1.yaml
> 
<snip />

> [root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
> include_with_vars.yaml -e condition=false

Here condition is a string and not a bool so you need

{{ condition | bool | ternary ......


-- 
Kai Stian Olstad

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6416563.vzd7gj905g%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to