Re: [ansible-project] Re: KEY: VALUE iterations

2020-02-16 Thread Anand Solomon
Hi, I still don’t have an answer for this. Is there someone to help me ? -- 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

Re: [ansible-project] Re: KEY: VALUE iterations

2020-02-14 Thread Anand Solomon
"Revoke EXECUTE on UTL_FILE from TSTSCH;" ] ] On Friday, February 14, 2020 at 8:28:12 AM UTC-5, Stefan Hornburg (Racke) wrote: > > On 2/14/20 2:10 PM, Anand Solomon wrote: > > Thanks Rache, > > This didn't solve the issue. I need to rea

Re: [ansible-project] Re: KEY: VALUE iterations

2020-02-14 Thread Anand Solomon
Thanks Rache, This didn't solve the issue. I need to read the content in the "msg" in "results" section On Friday, February 14, 2020 at 7:52:31 AM UTC-5, Stefan Hornburg (Racke) wrote: > > On 2/14/20 1:31 PM, Anand Solomon wrote: > > Thanks Vlado,

Re: [ansible-project] Re: KEY: VALUE iterations

2020-02-14 Thread Anand Solomon
> On Thu, 13 Feb 2020 13:33:32 -0800 (PST) > Anand Solomon > wrote: > > > - name: Display the query results > > debug: > > msg: "{{query_result.msg}} > > > > I get the below > > "msg": "All items complete

Re: [ansible-project] Re: KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
ictionary to "take > the > values". > > On Thu, 13 Feb 2020 11:52:30 -0800 (PST) > Anand Solomon > wrote: > > > I want to parse the json output and tak

[ansible-project] Re: KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
CUTE on UTL_FILE from TSTSCH;" ] Here is my Jinja template - name: Generate Revoke Statement copy: dest: /home/ansible/Playbooks/{{sname}}/sql/{{item.key}}_revoke.sql content: | spool /home/ansible/Playbooks/{{sname}}/log/{{item.key}}

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
"Revoke EXECUTE on UTL_FILE from TSTSCH;" ] Here is my Jinja template - name: Generate Revoke Statement copy: dest: /home/ansible/Playbooks/{{sname}}/sql/{{item.key}}_revoke.sql content: | spool /home/ansible/Playbooks/{{sname}}/log/{{item.key}}.log {% for line in query_result.results | flatten %}

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
}, "item": { "key": "Script1", "value": "select name from v$database;" }, "msg": [ [ "LCKTSTDB&

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
ool /home/ansible/Playbooks/{{sname}}/log/{{item.key}}.log {% for line in query_result.msg |flatten %} {{ line }} {% endfor %} spool off; delegate_to: localhost connection: local loop: "{{ scripts|dict2items }}" How do I capture onl

Re: [ansible-project] KEY: VALUE iterations

2020-02-13 Thread Anand Solomon
t;{{oracle_env}}" register: sqloutput connection: local On Wednesday, February 12, 2020 at 11:22:46 PM UTC-5, Vladimir Botka wrote: > > On Wed, 12 Feb 2020 19:52:31 -0800 (PST) > Anand Solomon > wrote: > > > How will get the value of item.key and item.val

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.

[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

Re: [ansible-project] How to get clean output ?

2020-02-12 Thread Anand Solomon
Thank you so much Vlado. It works fine. On Wednesday, February 12, 2020 at 1:49:13 PM UTC-5, Vladimir Botka wrote: > > On Wed, 12 Feb 2020 08:51:12 -0800 (PST) > Anand Solomon > wrote: > > > - name: Generate Revoke Statement > > local_action: > >

Re: [ansible-project] How to get clean output ?

2020-02-12 Thread Anand Solomon
--> localhost]: FAILED! => {"changed": false, "msg": "dest is required"} Is that something I am missing ? On Tuesday, February 11, 2020 at 6:06:42 PM UTC-5, Vladimir Botka wrote: > > On Tue, 11 Feb 2020 14:59:04 -0800 (PST) > Anand Solomon > wrote: > >

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Instead of maintaining another template file. Can I embed the content in the playbook itself ? On Tuesday, February 11, 2020 at 5:57:09 PM UTC-5, Anand Solomon wrote: > > Thank you so much Vlado. This works fine. > > On Tuesday, February 11, 2020 at 5:40:05 PM UTC-5, Vladimir

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Thank you so much Vlado. This works fine. On Tuesday, February 11, 2020 at 5:40:05 PM UTC-5, Vladimir Botka wrote: > > On Tue, 11 Feb 2020 14:02:45 -0800 (PST) > Anand Solomon > wrote: > > > I need to get this > > Revoke EXECUTE on UTL_FILE from TESTACC1; Revoke

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Thanks Hugo for helping me. Basically I am running a sql command that runs a sql query which gives the below results. (this is a debug out) "msg": { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false,

[ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Hi, How will I get only the sql statement from the json output ? I am registering this as " register: query_result" Here is my json output "msg": { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false,

[ansible-project] Running Playbooks against RDS

2020-02-06 Thread Anand Solomon
Hi, How to even run ansible commands to the RDS Oracle instance ? Is there a special parameter I should be passing ? . I have "connection; local" in the task. I tried to execute the playbook, I get the below error. Am i missing something ? Here is my playbook variable. vars: oracle_home:

[ansible-project] Ansible for RDS

2020-02-06 Thread Anand Solomon
Hi, How to even run ansible commands to the RDS Oracle instance ? Is there a special parameter I should be passing ? . I have "connection; local" in the task. I tried to execute the playbook, I get the below error. Am i missing something ? Here is my playbook variable. vars: oracle_home:

Re: [ansible-project] How to do 3 with_items in the same task ?

2020-02-05 Thread Anand Solomon
t; value: "{{value2}}" privilege: "{{privs2}}" On Monday, February 3, 2020 at 11:36:40 PM UTC-5, Vladimir Botka wrote: > > On Mon, 3 Feb 2020 16:31:21 -0800 (PST) > Anand Solomon > wrote: > > > variablefile.yml > > > > var1:

[ansible-project] How to do 3 with_items in the same task ?

2020-02-03 Thread Anand Solomon
Hi, I am reading 3 different variable from a text file and want to iterate in 3 different with_items. variablefile.yml vars1 : - first_value1 - first_value 2 var2: - second_value1 - second_value2 var3: - third_value1 - third_value2 I want to read the value from the text file and pass

Re: [ansible-project] Filter out text from a json object created by an ansible register

2020-01-30 Thread Anand Solomon
Just this made the trick. Thanks very much roles: "{{item}}" quiet: false environment: "{{oracle_env}}" register: user_privs with_items : "{{query_result.msg}}" On Thursday, January 30, 2020 at 3:20:38 PM UTC-5, Anand Solomon wr

Re: [ansible-project] Filter out text from a json object created by an ansible register

2020-01-30 Thread Anand Solomon
The result I get from the query_result is something like this [["TESTDBA"], ["TESTDBA2"]] I want to know how to pass this variable removing the square brackets and the *roles* in the task On Thursday, January 30, 2020 at 2:52:43 PM UTC-5, Anand Solomon wrote: > > Hi,

Re: [ansible-project] Filter out text from a json object created by an ansible register

2020-01-30 Thread Anand Solomon
privs: - INSERT ANY TABLE state: absent *roles: "{{ query_result }}"* quiet: false environment: "{{oracle_env}}" register: user_privs delegate_to: localhost On Thursday, January 30, 2020 at 9:02:02 AM UTC-5, Vladimir Botka wrote:

Re: [ansible-project] Filter out text from a json object created by an ansible register

2020-01-30 Thread Anand Solomon
C-5, Vladimir Botka wrote: > > On Thu, 30 Jan 2020 05:38:17 -0800 (PST) > Anand Solomon > wrote: > > > - name: Display the query results > > debug: > > msg: "{{ query_result }}" > > > > and I get [["TESTDBA"]], I

Re: [ansible-project] oracle_user module error expecting cx_oracle in DB server

2020-01-30 Thread Anand Solomon
Hi, Thank you so much. I made this work by commenting with -- instead of # Thank you for your help. On Tuesday, January 28, 2020 at 3:38:06 PM UTC-5, Stefan Hornburg (Racke) wrote: > > On 1/28/20 7:05 PM, Anand Solomon wrote: > > It goes soon after

[ansible-project] Filter out text from a json object created by an ansible register

2020-01-30 Thread Anand Solomon
Hi, How do I take only the text from the below from json created by an ansible register I have this - name: Display the query results debug: msg: "{{ query_result }}" and I get [["TESTDBA"]], I want the value to be TESTDBA. Basically I am passing this value to another

Re: [ansible-project] Error using state: absent in oracle_grant module

2020-01-29 Thread Anand Solomon
ne that: > > https://github.com/oravirt/ansible-oracle-modules/issues > > So, please don’t cross post questions regarding those modules to this > list. > > Thx ! > > On Tue, 28 Jan 2020 at 15:23, Anand Solomon > wrote: > >> Hi, >> >> I am runn

[ansible-project] oracle_privs doesn

2020-01-29 Thread Anand Solomon
I am trying to use oracle_privs module to revoke privileges in account. Below is my playbook tasks: - name: This playbook will grant or revoke privilges in the user. oracle_privs: user: "{{user}}" password: "{{password}}" service_name: "{{sname}}"

Re: [ansible-project] oracle_user module error expecting cx_oracle in DB server

2020-01-28 Thread Anand Solomon
. ### */ set serveroutput on; select username from dba_users; / .. On Tuesday, January 28, 2020 at 12:34:00 PM UTC-5, Stefan Hornburg (Racke) wrote: > > On 1/28/20 6:31 PM, Anand S

Re: [ansible-project] oracle_user module error expecting cx_oracle in DB server

2020-01-28 Thread Anand Solomon
. ### */ On Tuesday, January 28, 2020 at 12:18:33 PM UTC-5, Stefan Hornburg (Racke) wrote: > > On 1/28/20 6:05 PM, Anand Solomon wrote: > > Hi, > > I am using oracle_sql module and running a sql scri

Re: [ansible-project] oracle_user module error expecting cx_oracle in DB server

2020-01-28 Thread Anand Solomon
can keep the comments and execute the sql script ? On Saturday, January 25, 2020 at 5:17:44 PM UTC-5, Dick Visser wrote: > > Hi > > Ansible doesn’t have such a module, so I assume this is a 3rd party module? > In that case you might have more luck asking the module’s authors for >

[ansible-project] Error using state: absent in oracle_grant module

2020-01-28 Thread Anand Solomon
Hi, I am running the below playbook and I am getting errors when having 'state: absent', but when I have 'present', it works fine. tasks: - name: This playbook will create the user. oracle_grants: user: "{{user}}" password: "{{password}}"

Re: [ansible-project] Running a select statement as script using oracle_sql module

2020-01-27 Thread Anand Solomon
Looks like we can only use sql parameter in oracle_sql module. On Saturday, January 25, 2020 at 5:30:05 PM UTC-5, Dick Visser wrote: > > This isn't a module that ships with ansible, please contact the > module's authors for support. > > On Sat, 25 Jan 2020 at 16:03, Anand S

Re: [ansible-project] Simple Loop

2020-01-27 Thread Anand Solomon
}" > > > If you get that comma delimited string from somewhere else (which I > asked but got no response to), then you'd have to manually split and > trim: > > loop: "{{ schemaname.split(',') | map('trim') | list }}" > > > > > > > On Mon,

Re: [ansible-project] Simple Loop

2020-01-27 Thread Anand Solomon
Yes, All I want to create is the user from the list (vars). This will be hard coded value from the vars and the password will be the same for all the users. On Monday, January 27, 2020 at 10:34:25 AM UTC-5, Dick Visser wrote: > > On Mon, 27 Jan 2020 at 15:57, Anand Solomon &

[ansible-project] Simple Loop

2020-01-27 Thread Anand Solomon
Hi, I want to create users in the database using Ansible. I need ansible to run the task (creating user) for all the users mentioned in the vars: schemaname. How do I do that in loop ? var: schemaname: user1, user2, user3 tasks: - name: This playbook will create the user.

[ansible-project] oracle_user module error expecting cx_oracle in DB server

2020-01-25 Thread Anand Solomon
I am trying to create oracle user using oracle_user module in a RDS server. Here is my playbook - hosts: all vars: oracle_home: /home/ansible/instantclient_12_2 user: SYSDBA password: ** prt: "1521" hostname: "RDS Instance" sname: TESTDB oracle_env:

[ansible-project] Running a select statement as script using oracle_sql module

2020-01-25 Thread Anand Solomon
Hi, I am trying to run a sql script which has simple select statement. (select username from dba_users). Will oracle_sql module run a "Select" statement and returns the results ? My playbook is - name: Script will creates Oracle DBA IDs and Profiles on AWS RDS. oracle_sql:

Re: [ansible-project] How to skip the playbook based on a condition

2020-01-24 Thread Anand Solomon
Thanks I got this working. On Friday, January 24, 2020 at 3:37:43 PM UTC-5, Dick Visser wrote: > > meta: end_play > is what you want > > https://docs.ansible.com/ansible/latest/modules/meta_module.html > > > On Fri, 24 Jan 2020 at 21:01, Anand Solomon > wrote: >

[ansible-project] How to skip the playbook based on a condition

2020-01-24 Thread Anand Solomon
Hi, I basically wanted to skip the remaining of the playbook if a file exists - name: Check if the file exists stat: path: /home/ansible/dbname/sql/file.sql register: optional_file - debug: msg: "File Exists" when: optional_file.stat.exists == True