Hi,
Thanks for the solution. The question, I am asking may be a simple
question. I am new to ansible, so trying to learn.
This is what I need to understand.
1. Run the below
sql: select grantee FROM DBA_SYS_PRIVS where PRIVILEGE='INSERT ANY
TABLE' and grantee not like 'SYS' and grantee != 'WMSYS' and grantee !=
'DBA' and grantee != 'IMP_FULL_DATABASE';
register: query_result
The query result will be the users in the DB has DBA_SYS_PRIVS and it can
be more than one.I want to iterate the below task passing the username
dynamically.
2. The query_result have to be iterated in the below
- name: This playbook will grant or revoke privilges in the user.
oracle_privs:
user: "{{user}}"
password: "{{password}}"
service_name: "{{sname}}"
port: "{{prt}}"
hostname: "{{hostname}}"
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:
>
> On Thu, 30 Jan 2020 05:38:17 -0800 (PST)
> Anand Solomon <[email protected] <javascript:>> wrote:
>
> > - name: Display the query results
> > debug:
> > msg: "{{ query_result }}"
> >
> > and I get [["TESTDBA"]], I want the value to be TESTDBA.
>
> The value you're looking for is the first item of the first list
>
> - debug:
> msg: "{{ query_result.0.0 }}"
>
> gives
>
> "msg": "TESTDBA"
>
> 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/8079ec29-738a-4cdc-8a67-4549fd2b55b8%40googlegroups.com.