On Thu, 13 Feb 2020 09:25:16 -0800 (PST)
Anand Solomon <[email protected]> wrote:

> Here is what I get as the debug out when I run my loop. I need to parse the 
> JSON and get the hightlighted value to my Jinja template.

  I don't see anything highlighted. What am I missing?


>     "msg": {
>         "changed": false,
>         "msg": "All items completed",
>         "results": [
>             {
>                 "ansible_facts": {
>                     "discovered_interpreter_python": "/usr/bin/python"
>                 },
>                 "ansible_loop_var": "item",
>                 "changed": false,
>                 "failed": false,
>                 "invocation": {
>                     "module_args": {
>                         "host": 
> "tstdb.cds56fb9ngoi.us-east-1.rds.amazonaws.com",
>                         "hostname": 
> "tstdb.cdst2nb9ngoi.us-east-1.rds.amazonaws.com",
>                         "mode": "normal",
>                         "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>                         "port": "1521",
>                         "script": null,
>                         "service_name": "tstdb",
>                         "sql": "select name from v$database;",
>                         "user": "DBUSER",
>                         "username": "DBUSER"
>                     }
>                 },
>                 "item": {
>                     "key": "Script1",
>                     "value": "select name from v$database;"
>                 },
>                 "msg": [
>                     [
>                         "LCKTSTDB"
>                     ]
>                 ]
>             }
> 
> On Thursday, February 13, 2020 at 12:17:18 PM UTC-5, Vladimir Botka wrote:
> >
> > On Thu, 13 Feb 2020 08:32:08 -0800 (PST) 
> > Anand Solomon <[email protected] <javascript:>> wrote: 
> >  
> > > sql works fine actually. No issues with that. I am getting the query 
> > > results. Here is the result 
> > > 
> > >     "msg": { 
> > >         "changed": false, 
> > >         "msg": "All items completed", 
> > >         "results": [ 
> > >             { 
> > >                 "ansible_facts": { 
> > >                     "discovered_interpreter_python": "/usr/bin/python" 
> > >                 }, 
> > >                 "ansible_loop_var": "item", 
> > >                 "changed": false, 
> > >                 "failed": false, 
> > >                 "invocation": { 
> > >                     "module_args": { 
> > >                         "host": 
> > > "tstdb.cdst2lsongoi.us-east-1.rds.amazonaws.com", 
> > >                         "hostname": 
> > > "tstdb.cdst2lsongoi.us-east-1.rds.amazonaws.com", 
> > >                         "mode": "normal", 
> > >                         "password":   
> > "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",   
> > >                         "port": "1521", 
> > >                         "script": null, 
> > >                         "service_name": "tstdb", 
> > >                         "sql": "select name from v$database;", 
> > >                         "user": "DBUSER", 
> > >                         "username": "DBAUSER" 
> > >                     } 
> > >                 }, 
> > >                 "item": { 
> > >                     "key": "Script1", 
> > >                     "value": "select name from v$database;" 
> > >                 }, 
> > >                 "msg": [ 
> > >                     [ 
> > >                         "TSTDB" 
> > >                     ] 
> > >                 ] 
> > >             } 
> > > 
> > > [...] 
> > > How do I capture only the query result which is just the username ?   
> >  
> > > > 
> > > >       - name: Script will revoke 
> > > >         oracle_sql: 
> > > >           username: "{{ user }}" 
> > > >           password: "{{ password }}" 
> > > >           service_name: "{{ sname }}" 
> > > >           port: "{{ prt }}" 
> > > >           sqlId: "{{ hostnme }}" 
> > > >           sql: "{{ item.value }}' 
> > > >         loop: "{{ scripts|dict2items }}"   
> >
> > I don't understand what "the query result which is just the username" 
> > means. 
> > What result do you expect? 
> >  
> 




-- 
Regards,
Vladimir

Vladimir Botka
[email protected]
+420.773.041.182
Smeralova 13, Prague 17000, Czech
https://www.botka.link/
https://www.linkedin.com/in/vbotka/
--

-- 
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/20200213183413.2257cd47%40gmail.com.

Attachment: pgpGRXKHpUgr7.pgp
Description: OpenPGP digital signature

Reply via email to