I found out how. I created a variable for the {{ inventory_hostname }} 
first.

vars:
  vsrx: "{{ inventory_hostname }}"

{% set title = csvfile.split("\n")[0].split(',') %}
{% for item in csvfile.split("\n")[1:] %}
*{%   if vsrx in item %}*
{%     set list = item.split(",") %}
{%     for element in range(list | count) %}
{{ title[element]|trim }}: {{ list[element]|trim }}
{%     endfor %}
{%   endif %}
{% endfor %}

-- 
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/99965064-2b6e-4319-9dbd-d9034359cc3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to