How to pass a variable to a filter plugin ?

41 views
Skip to first unread message

Gustavo Aguiar

unread,
Dec 31, 2015, 5:54:28 PM12/31/15
to ansible...@googlegroups.com
Hi All,

First of all, Happy New Year to everybody. :-)

I would like to know if it is possible to pass a variable to a filter.

I have this code that works with a predefined text:

"{{ ec2_vpc_out.subnets | get_subnets('Name', ’TheName') | first }}”

Now I need to replace the ‘TheName’ argument with a variable. E.g.:

"{{ ec2_vpc_out.subnets | get_subnets('Name', <item.name>) | first }}”

Is there a way of doing this ?

Thanks,
Gustavo Aguiar



This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com

Brian Coca

unread,
Jan 1, 2016, 12:36:27 AM1/1/16
to Ansible Project
It should be this simple:

"{{ ec2_vpc_out.subnets | get_subnets('Name', item.name) | first }}”



--
Brian Coca

Gustavo Aguiar

unread,
Jan 4, 2016, 9:57:22 AM1/4/16
to ansible...@googlegroups.com
Thank you Brian! I was adding the ' and this was breaking my tests…

Thanks again,
—Gustavo
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8mJ48Mcu-KgaTy6WoCFCZqsS6O3u58vjs8RMBtcMT6p%3Dw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages