Sorry, one more thing. I want to identify if the title equals Hostname and
both the title and list index match. I have it working below, but was
hoping there is a cleaner way of doing this.

{% set title = csvfile.split("\n")[0].split(',') %}
  {% for item in csvfile.split("\n")[1:] %}
  {% set list = item.split(",") %}

  {%   if title[0] == "Hostname" and list[0] %}
    {{ list[0]|trim() }}:
  {%   elif title[1] == "Hostname" and list[1] %}
    {{ list[1]|trim() }}:
  {%   elif title[1] == "Hostname" and list[1] %}
    {{ list[1]|trim() }}:
  {%   elif title[2] == "Hostname" and list[2] %}
    {{ list[2]|trim() }}:
  {%   elif title[3] == "Hostname" and list[3] %}
    {{ list[3]|trim() }}:
  {%   elif title[4] == "Hostname" and list[4] %}
    {{ list[4]|trim() }}:
  {%   elif title[5] == "Hostname" and list[5] %}
    {{ list[5]|trim() }}:
  {%   endif %}

  {{ 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() }}
  {% endfor %}




On Fri, Dec 1, 2017 at 3:54 PM, texas living <[email protected]> wrote:

> That worked, thanks again for you help.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/t8RUjtnZlyM/unsubscribe.
> To unsubscribe from this group and all its topics, 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/94204212-a180-455e-b604-27b71cef1c2a%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/94204212-a180-455e-b604-27b71cef1c2a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAC4CMUa94bP-eXdYKv9hLuqsOLuEz4yD70vnkkEzs2o6KP%2Bqkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to