I do have one more question. Say I am not sure if the last list[6] variable 
is defined, how would I write that? I tried the below but did not work.

{% set title = csvfile.split("\n")[0].split(',') %}
{% for item in csvfile.split("\n")[1:] %}
{%   set list = item.split(",") %}
  {{ list[1]|trim() }}:
    {{ title[0] }}: {{ list[0]|trim() }}
    {{ title[1] }}: {{ list[1]|trim() }}
    {{ title[2] }}: {{ list[2]|trim() }}
    {{ title[3] }}: {{ list[3]|trim() }}
    {{ title[4] }}: {{ list[4]|trim() }}
    {{ title[5] }}: {{ list[5]|trim() }}
{%   if {{ list[6] }} %}
    {{ title[6] }}: {{ list[6]|trim() }}
{%   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/d0bef8f1-d6e9-4b93-bc14-6bcbcf54e669%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to