Jon I actually got it with this

{% for myitem in item.sitename|list %} 

I left my Task the same with with items but changed my VAR to an array

---
parameters:
  - {sitename: ['site1', 'site2', 'site3', 'site4'] }


Thanks for you help




On Tuesday, April 11, 2017 at 8:59:54 AM UTC-4, Jeffrey Ward wrote:
>
> Hi,
>
>
> I am new to ansible and new to the form.
>
> I am wondering how to loop through a template
>
> my template looks like this
>
>
> { item.sitename  }}-test,{{ item.sitename  }} description
>
>  and my variables look like this
>
> ---
> parameters:
>   - { sitename: testsite1  }
>   - { sitename: testsite2  }
>
> my Task looks like this
>
> ---
> - name: Lines Templates
>   template: src=test.j2 dest=../ansible/configurations/test.csv
>   with_items: "{{ parameters }}"
>
> this works but I only get the one line of the last entry  with looks like 
> this
>
> testsite2-test,testsite2 description
>
>
> But what I am tring to get is this
>
>
> testsite1-test,testsite1 description
> testsite2-test,testsite2 description
>
>
> I have been looking and reading the Jinga2 Templates doc but truble 
> finding which {% for in %} to use
>
> if some one could point me to the right direction that would be great.
>
>
> Jeff
>
>
>
>
>
>
>
>
>

-- 
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/4869f37d-71d5-46ec-a07e-d4d0c4e8da14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to