with_items accepts a list. I don't understand the purpose of using 
with_items here. You can directly set  cid as {{ group1.cid }} and env as 
{{ group1.env }}

On Sunday, September 30, 2018 at 12:46:12 PM UTC-5, coach rhca wrote:
>
> Hi,
>
> I am trying to create a role in which i have variable file ( main.yml) 
> under vars folder containing 
>
> ---
>  group1:
>     cid: t1234
>     env: uat
>     status: active
>
>
> and in the tasks (main.yml ) i have 
> ---
> - name: setting values
>   set_fact:
>     cid: "{{item.cid}}"
>     env : "{{item.env}}"
>   with_items: "{{ group1}}"
>
>   ****other lines*********
>
> but when i run the ansible-playbook --syntax-check for task file i get the 
> error 
>  #ansible-playbook -syntax-check tasks/main.yml
>
> *ERROR! 'with_items' is not a valid attribute for a Play*
>
>
>
>
> *The offending line appears to be:---- name: setting values  ^ here*
>
>
> Could you please let know where we are going wrong ,also if we can use 
> set_fact with with_items or with_dict.
>
>
>
>
>
>
>

-- 
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/29e3cadd-b00f-4ca7-8d8d-34231827a1b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to