You helped me Vlado. Thanks again. This works very well. 

How will get the value of item.key and item.value to variable

        sqlqry = "{{ item.key }}"
        sqlid = "{{ item.value }}"


On Wednesday, February 12, 2020 at 10:38:22 PM UTC-5, Vladimir Botka wrote:
>
> On Wed, 12 Feb 2020 18:02:20 -0800 (PST) 
> Anand Solomon <[email protected] <javascript:>> wrote: 
>
> > What is the best way to loop the below KEY : VALUE ? 
> > [...] 
> >  sqlvar.yml 
> >  Key: Value 
> >  Script1: select username from dba_users; 
> >  Script2: select file_name from dba_data_files; 
> >  Script3: select name from v$profile; 
> >  Script4: select username from dba_profile; 
>
> Try this 
>
>     - include_vars: 
>         file: /home/ansible/sqlvar.yml 
>         name: scripts 
>     - debug: 
>         msg: "{{ item.key }}: {{ item.value }}" 
>       loop: "{{ scripts|dict2items }}" 
>
> HTH, 
>
>         -vlado 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20803d2f-c560-4558-8aaa-549490c3d01d%40googlegroups.com.

Reply via email to