Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
I want to parse the json output and take the values Here is the json output from the playbook I run, TASK [Display the query results] > > ok:

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Vladimir Botka
On Thu, 13 Feb 2020 09:25:16 -0800 (PST) Anand Solomon 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":

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
Sorry about that. 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. "msg": { "changed": false, "msg": "All items completed", "results": [ { "ansible_facts":

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Vladimir Botka
On Thu, 13 Feb 2020 08:32:08 -0800 (PST) Anand Solomon 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": [ > { >

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
Hello Vlado, 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": {

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Vladimir Botka
On Thu, 13 Feb 2020 05:57:39 -0800 (PST) Anand Solomon wrote: > - include_vars: > file: /home/ansible/Playbooks/Compliance1.yml > name: scripts > - debug: > msg: "{{ sqlqry }}: {{ sqlid }}" > vars: > sqlqry: "{{ item.key }}" > sqlid: "{{

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
Thanks again Vlado. I am struggling with the basics here... This is my block - include_vars: file: /home/ansible/Playbooks/Compliance1.yml name: scripts - debug: msg: "{{ sqlqry }}: {{ sqlid }}" vars: sqlqry: "{{ item.key }}" sqlid: "{{

Re: [ansible-project] KEY: VALUE iterations

2020-02-12 Thread Vladimir Botka
On Wed, 12 Feb 2020 19:52:31 -0800 (PST) Anand Solomon wrote: > How will get the value of item.key and item.value to variable > > sqlqry = "{{ item.key }}" > sqlid = "{{ item.value }}" Declare the vars in the scope of the task. For example - debug: msg: "{{ sqlqry

Re: [ansible-project] KEY: VALUE iterations

2020-02-12 Thread Anand Solomon
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

Re: [ansible-project] KEY: VALUE iterations

2020-02-12 Thread Vladimir Botka
On Wed, 12 Feb 2020 18:02:20 -0800 (PST) Anand Solomon 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; >

[ansible-project] KEY: VALUE iterations

2020-02-12 Thread Anand Solomon
Hi, What is the best way to loop the below KEY : VALUE ? *main.yml* var_files: - /home/ansible/sqlvar.yml - name: Script oracle_sql: sql: {{Value}} environment: "{{oracle_env}}" register: query_result connection: local - name: Runs statements command: $ORACLE_HOME/sqlplus -s