Basically I want to read sqlvar.yml, pass the "select username from
dba_users;" to SQLID and "Script1" to SQLQRY one by one.
On Wednesday, February 12, 2020 at 10:52:32 PM UTC-5, Anand Solomon wrote:
>
> 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]> 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/fdf234ef-3362-4af9-9f8d-e65d2558bc19%40googlegroups.com.