Actually, the dictionary looks like this-

d2 = {'4.4.4.4':'10.0.0.0/8,11.0.0.0/8', '5.5.5.5':'10.0.0.0/8'}

On Monday, February 29, 2016 at 8:05:23 AM UTC-8, amit bhagat wrote:
>
> I have written a custom module "filter_prefix" that accepts "host" and 
> "prefixes".
>
> I have a dictionary that looks like this - 
> d2 = {'4.4.4.4':'10.0.0.0/8','11.0.0.0/8', '5.5.5.5':'10.0.0.0/8'}
>
> In the API script, I have -
>
> hosts = d2.keys()
> device_inventory = Inventory(hosts)
>
> pb = Runner(
>         module_name = 'filter_prefix',
>         module_args = 'host={{ inventory_hostname }} prefixes= ???',
>         transport = local,
>         inventory = device_inventory)
>
> I would like to be able to pass appropriate 'value'  to prefixes based on 
> 'host' from d2 dictionary. I tried using -
> prefixes="d2[ '{{ inventory_hostname }}' ]" but then it doesn't expand d2.
>
> I am running ansible version 1.9.2.
>
> Any ideas?
>
> Amit
>

-- 
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/47a48fde-07da-4d2d-be46-e6f88ae04750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to