Closed topher-debusk closed 6 years ago
Hi, a couple of things:
In the meantime, there is another module called oracle_privs
which I use to set object privs.
So in your case, I would have split the privileges into multiple keys and 2 plays, e.g (note, this isn't actually tested but you get the idea):
oracle_roles:
name: prtg_role state: present role_grants:
task: Manage object privs oracle_privs: roles={{ item.name }} state={{ item.state }} privs={{ item.obj_privs }} objs={{ item.obj_objects }} hostname: "{{ ansible_fqdn }}" service_name: "{{ oracle_sid }}" user: sys mode: sysdba password: "{{ password }}" with_items:
name: Add grants to role oracle_grants: hostname: "{{ ansible_fqdn }}" service_name: "{{ oracle_sid }}" user: sys mode: sysdba password: "{{ password }}" role: "{{ item.name }}" grants: "{{ item.role_grans }}" state: "{{ item.state }}" environment: "{{ oracle_env }}" with_items:
I did a pull, just to double check my version... I think I was pretty up to date.
I'll give your suggestion a shot. Thanks for taking a look.
Unpacking objects: 100% (6/6), done.
From https://github.com/oravirt/ansible-oracle-modules
19665a0..6b675e5 master -> origin/master
Updating 19665a0..6b675e5
Fast-forward
oracle_tablespace | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 188 insertions(+), 3 deletions(-)
Ok.
FYI - I'm adding object priv management now to oracle_grants
, so should be done in a couple of days (hopefully)
Hi,
I've added the functionality to deal with object privileges to oracle_grants
. I've added another key (object_privs
), which is passed as a list. Each key should be in the format:
priv:owner.object
e.g
select:sys.dba_tablespaces
grants:
- create session
...
object_privs:
- select:sys.v_$session
- select:sys.dba_data_files
- insert,update,delete,select:owner.table
...
The module is in need of a pretty big re-factor, but it works for now.
Sorry it took me so long to get around to checking this, but it appears to be working :)
Thanks a bunch!
There is a good chance I am just doing this wrong... so feel free to correct me :)
Here are my vars:
Here are my tasks:
Here is the output I get on each run:
It does not seem to be checking if the role already has the priv, it just updates it an marks it as changed, even though the role already had the priv granted.
Thanks for your time! I love this module, you should get it added to the core ansible project!!!