python - Jinja how to get the ansible_inteface[modul output -


i want find interfaces have module ixgbe.

therefor want use ansible facts.

in facts have list of interfaces array in variable ansible_interfaces. want use name of interfaces "ansible_" before. have in module whre ixgbe defined or not defined. eth0 interface should show me output of ansible_eth["module"]. have following code:

{% in ansible_interfaces %}  {% set x = 'ansible_%s' |format (i) |replace ("-", "_")%}                //the replace necesarry because of interfaces use - in interface list _in ansible_interfacename  {% if [x["module"]] defined %}  {{x}}  {{[(x["module"])]}}  {{(ansible_eth0["module"])}}  {%endif%}  {% endfor %} 

and following output:

ansible_br_config [undefined] ixgbe ansible_eth5 [undefined] ixgbe ansible_eth4 [undefined] ixgbe ansible_eth3 [undefined] ixgbe ansible_eth2 [undefined] ixgbe ansible_eth1 [undefined] ixgbe ansible_eth0 [undefined] ixgbe

the undefined should give the ixgbe output when defined. thank help.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -