Isn't play_hosts a reserved ansible variable (deprecatd but still..). Maybe 
try another name.

Am Donnerstag, 24. August 2017 16:36:41 UTC+2 schrieb Jean-Francois Bibeau:
>
> Hi,
>
> Trying to do the following, and struggling to find a way to do this.
>
> I build a list of strings, and want to conditionally append a string at 
> the end of the list, but only if the variable is defined.
>
> This works fine:
>
> play_hosts | union([optional_ip])
>
>
> Which appends optional_ip to play_hosts, however if optional_ip is not 
> defined, I would like to simply drop the union filter... If I change it to:
>
> play_hosts | union([optional_ip | default(None)])
>
> It appends an empty string. I was hoping I could maybe use "or omit" after 
> the union but can't quite get that to work.
>
> Any suggestions?
>
> Thanks!
>
>

-- 
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/8ff0dbb8-1bcb-425f-a8fe-e38e9817f3ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to